(function e(b,g,d){function c(n,k){if(!g[n]){if(!b[n]){var j=typeof require=="function"&&require;
if(!k&&j){return j(n,!0)
}if(a){return a(n,!0)
}var m=new Error("Cannot find module '"+n+"'");
throw m.code="MODULE_NOT_FOUND",m
}var h=g[n]={exports:{}};
b[n][0].call(h.exports,function(l){var o=b[n][1][l];
return c(o?o:l)
},h,h.exports,e,b,g,d)
}return g[n].exports
}var a=typeof require=="function"&&require;
for(var f=0;
f<d.length;
f++){c(d[f])
}return c
})({1:[function(g,f,j){var a,l,b,k,d,c,m={}.hasOwnProperty,h=function(q,o){for(var n in o){if(m.call(o,n)){q[n]=o[n]
}}function p(){this.constructor=q
}p.prototype=o.prototype;
q.prototype=new p();
q.__super__=o.prototype;
return q
};
c=g("./router.coffee");
d=g("./models/listing.coffee");
b=g("./models/cleaning_jobs.coffee");
l=g("../../models/base.coffee");
k=g("./handlebars_helpers.coffee");
f.exports=a=(function(n){h(o,n);
function o(){return o.__super__.constructor.apply(this,arguments)
}o.prototype.initialize=function(){_.each(this.get("upcoming_reservations"),function(p){return p.cleaning_jobs=new b(p.cleaning_jobs)
});
this.listing=new d(this.get("listing_attributes").listing,{app:this,placeRecommendations:this.get("guidebook_data").recommendations,placeCategories:this.get("guidebook_data").categories,cleaningPreferenceAttributes:this.get("cleaning_preferences")});
return this.router=new c({app:this})
};
o.prototype.FB_COOKIE="fbsr_138566025676";
o.prototype.getFBCookie=function(){return JSCookie.cookie(this.FB_COOKIE)
};
return o
})(l)
},{"../../models/base.coffee":91,"./handlebars_helpers.coffee":2,"./models/cleaning_jobs.coffee":12,"./models/listing.coffee":17,"./router.coffee":23}],2:[function(b,c,a){var d=[].indexOf||function(h){for(var g=0,f=this.length;
g<f;
g++){if(g in this&&this[g]===h){return g
}}return -1
};
Handlebars.registerHelper("each_with_index",function(m,h){var g,j,k,l,f;
g="";
for(l=0,f=m.length;
l<f;
l++){j=m[l];
k=j;
k.index=l;
g+=h.fn(k)
}return g
});
Handlebars.registerHelper("helpTooltip",function(f){var j,g,h;
h=JST["manage_listing/help_tooltip"];
j={trigger:f.hash.trigger,body:f.fn(f.hash.context)};
g=h(j);
return new Handlebars.SafeString(_.unescape(g))
});
Handlebars.registerHelper("subsectionHelper",function(g){var k,h,f,j;
j=JST["manage_listing/subsection_template"];
f=g.hash.subtitleKey?I18n.t(g.hash.subtitleKey):g.hash.subtitle;
k={headerKey:g.hash.headerKey,subtitle:f,extendedSubtitleContent:g.hash.extendedSubtitleContent,subtitleContentWithHomeSafetyLink:g.hash.subtitleContentWithHomeSafetyLink,subtitleContentWithContactLink:g.hash.subtitleContentWithContactLink,body:g.fn(g.hash.context),saving_ui_template:JST["manage_listing/saving_ui"](),attrClass:g.hash.attrClass,attrId:g.hash.attrId};
h=j(k);
return new Handlebars.SafeString(_.unescape(h))
});
Handlebars.registerHelper("displayAddressHelper",function(h){var g,k,m,j,f,l;
g=h.hash.address;
k=h.hash.addressPresenter;
m=JST["manage_listing/address/address_display/edit_address_link"]();
j=JST["manage_listing/address/address_display/address_display_default"];
if(l=g.country_code,d.call(_.keys(k),l)>=0){f=k[g.country_code].template;
j=JST["manage_listing/address/address_display/address_display_"+f]
}return j(g)+new Handlebars.SafeString(_.unescape(m))
});
Handlebars.registerHelper("addressPaneChrome",function(f){var j,g,h;
h=JST["manage_listing/address/address_flow_chrome"];
j={header:I18n.t(f.hash.headerKey),subheader:I18n.t(f.hash.subheaderKey),btnText:I18n.t(f.hash.btnKey),btnDisabled:f.hash.btnDisabled,body:f.fn(f.hash.context),altChoiceBtnHtml:f.hash.altChoiceBtnHtml};
g=h(j);
return new Handlebars.SafeString(_.unescape(g))
});
Handlebars.registerHelper("educationPaneHelper",function(f){var j,g,h;
h=JST["manage_listing/instant_book_v2/education_carousel_pane"];
j={paneNum:f.hash.paneNum,header:I18n.t(f.hash.headerKey),description:I18n.t(f.hash.descriptionKey),classes:f.hash.classes,imagePathKey:f.hash.imagePathKey};
g=h(j);
return new Handlebars.SafeString(_.unescape(g))
})
},{}],3:[function(c,d,a){var f,b;
b=c("underscore");
f=/\b/g;
d.exports=function(h){var g;
g={attributeLengths:{},countLeft:function(j){var k;
if((((k=this.attributeLengths[j])!=null?k.characters:void 0)!=null)){return this.charactersLeft(j)
}else{return this.wordsLeft(j)
}},validCount:function(l){var k,n,j,q,p,o,m;
if((((n=this.attributeLengths[l])!=null?n.characters:void 0)!=null)){k=this.characterCount(l);
if(((j=this.attributeLengths[l])!=null?j.characters.max:void 0)<k||((q=this.attributeLengths[l])!=null?q.characters.min:void 0)>k){return false
}}if((((p=this.attributeLengths[l])!=null?p.words:void 0)!=null)){k=this.wordCount(l);
if(((o=this.attributeLengths[l])!=null?o.words.max:void 0)<k||((m=this.attributeLengths[l])!=null?m.words.min:void 0)>k){return false
}}return true
},charactersLeft:function(k){var l,j;
if(((l=this.attributeLengths[k])!=null?l.characters:void 0)!=null){return((j=this.attributeLengths[k])!=null?j.characters.max:void 0)-this.characterCount(k)
}},wordsLeft:function(k){var l,j;
if(((l=this.attributeLengths[k])!=null?l.words:void 0)!=null){return((j=this.attributeLengths[k])!=null?j.words.max:void 0)-this.wordCount(k)
}},characterCount:function(j){var k;
return((k=this.get(j))!=null?k.length:void 0)||0
},wordCount:function(k){var l,j;
j=this.get(k)||"";
l=j.match(f);
if(l){return l.length/2
}else{return 0
}}};
return b.extend(h.prototype,g)
}
},{underscore:"underscore"}],4:[function(c,b,d){var a,j,f,g,k,h;
h=c("underscore");
k=function(l){return h.first(h.shuffle(l))
};
j={CLEAN_NOTHING:"clean_nothing",CLEAN_FOOD:"clean_only_food",DAY_OFFSET_TWO_BEFORE:-2,DAY_OFFSET_ONE_BEFORE:-1,DAY_OFFSET_SAME_DAY:0,DAY_OFFSET_ONE_AFTER:1,DAY_OFFSET_TWO_AFTER:2,SCHEDULE_TYPE_CHECKIN:"before_checkin",SCHEDULE_TYPE_CHECKOUT:"after_checkout",LAUNDRY_NONE:"none",LAUNDRY_LINENS:"linens",LAUNDRY_SERVICE:"laundry"};
g={randomStartTime:function(){return k(["09:00","09:30","10:00","10:30","11:00","11:30","12:00","12:30","13:00","13:30","14:00","14:30","15:00","15:30","16:00","16:30","17:00"])
}};
f={isCheckin:function(){return this.get("schedule_type")===j.SCHEDULE_TYPE_CHECKIN
},isCheckout:function(){return this.get("schedule_type")===j.SCHEDULE_TYPE_CHECKOUT
},cleanNothing:function(){return this.get("refrigerator_cleaning")===j.CLEAN_NOTHING
},linenService:function(){return this.get("laundry_service")==="linens"
},laundryService:function(){return this.get("laundry_service")==="laundry"
},noLaundryService:function(){return this.get("laundry_service")==="none"
},isPending:function(){return this.get("job_status")===j.STATUS_PENDING
},isCompleted:function(){return this.get("job_status")===j.STATUS_COMPLETED
},roomDiff:function(l){if(this.get("bedrooms")!=l.get("bedrooms")){return true
}if(this.get("bathrooms")!=l.get("bathrooms")){return true
}return false
}};
b.exports=a=function(l){h.extend(l.prototype,f);
h.extend(l,j);
return h.extend(l,g)
}
},{underscore:"underscore"}],5:[function(d,f,b){var c,a;
a={hasDiscount:function(){var g;
g=this.get("estimated_discount_amount");
return g&&g>0
},discountPercent:function(){return this.get("discount_percent")*100
}};
f.exports=c=function(g){return _.extend(g.prototype,a)
}
},{}],6:[function(d,f,a){var c,b;
b=d("underscore");
f.exports=c=function(h){var g,j;
j=h.prototype.sync;
g={sync:function(o,k,n){var m,l;
m=this.authenticatedUrlForMethod(o);
l=o==="read"?"GET":"POST";
return j.call(this,o,k,b.extend({},n,{type:l,url:m}))
},authenticatedUrlForMethod:function(m){var l,k;
l=b.result(this,"url")||(function(){throw Error("Bad url")
})();
k=this.urlSuffixFromMethod(m);
return Airbnb.Api.getUrl("/v1/"+l+k)
},urlSuffixFromMethod:function(k){return{read:"",update:"/update","delete":"/delete",create:""}[k]
}};
return b.extend(h.prototype,g)
}
},{underscore:"underscore"}],7:[function(b,d,a){var c;
c=function(f){return f.prototype.set=function(h,j,g){if(j==="true"){j=true
}else{if(j==="false"){j=false
}else{if(parseInt(j).toString()===j){j=parseInt(j)
}}}return f.__super__.set.call(this,h,j,g)
}
};
d.exports=c
},{}],8:[function(d,f,a){var j,h,c=function(k,l){return function(){return k.apply(l,arguments)
}
},b={}.hasOwnProperty,g=function(n,l){for(var k in l){if(b.call(l,k)){n[k]=l[k]
}}function m(){this.constructor=n
}m.prototype=l.prototype;
n.prototype=new m();
n.__super__=l.prototype;
return n
};
h=d("./model.coffee");
f.exports=j=(function(k){g(l,k);
function l(){this.toJSON=c(this.toJSON,this);
this.count=c(this.count,this);
return l.__super__.constructor.apply(this,arguments)
}l.prototype.initialize=function(n,m){if(m==null){m={}
}l.__super__.initialize.apply(this,arguments);
this.app=m.app;
this.listing=m.listing;
this.type=m.type||"weekly";
return this.jsonKeys=["pricing",this.type]
};
l.prototype.urlSuffixFromMethod=function(m){return{read:"?filter="+this.type,update:"","delete":"",create:""}[m]
};
l.prototype.url=function(){return""+(this.listing.url())+"/pricing"
};
l.prototype.count=function(){return _.keys(this.attributes).length
};
l.prototype.toJSON=function(){var q,n,m,r,p,o;
r={};
q=r;
for(n=p=0,o=this.jsonKeys.length-1;
p<=o;
n=p+=1){m=this.jsonKeys[n];
if(n===this.jsonKeys.length-1){q[m]=_.clone(this._changedSinceSave)
}else{q[m]={};
q=q[m]
}}return r
};
l.prototype.parse=function(o,m){var n;
n=o.pricing?o.pricing[this.type]:(_.each(_.keys(this.attributes),(function(p){return function(q){if(!p.attributes[q]){return delete p.attributes[q]
}}
})(this)),this.attributes);
return n
};
return l
})(h)
},{"./model.coffee":20}],9:[function(d,g,a){var f,c=function(j,k){return function(){return j.apply(k,arguments)
}
},b={}.hasOwnProperty,h=function(m,k){for(var j in k){if(b.call(k,j)){m[j]=k[j]
}}function l(){this.constructor=m
}l.prototype=k.prototype;
m.prototype=new l();
m.__super__=k.prototype;
return m
};
g.exports=f=(function(k){h(j,k);
function j(){this.clear_updated=c(this.clear_updated,this);
this.get_updated_days=c(this.get_updated_days,this);
this.special=c(this.special,this);
this.weekdays=c(this.weekdays,this);
this.weekends=c(this.weekends,this);
this.group_dates_into_month_collections=c(this.group_dates_into_month_collections,this);
return j.__super__.constructor.apply(this,arguments)
}j.prototype.initialize=function(){this.months={};
return this.on("reset",this.group_dates_into_month_collections)
};
j.prototype.group_dates_into_month_collections=function(){return this.each((function(l){return function(m){var o,n;
o=parseInt(m.get("future_date").split("-")[1]);
(n=l.months)[o]||(n[o]=new j);
return l.months[o].add(m)
}
})(this))
};
j.prototype.month_exists=function(l){return !_.isUndefined(this.months[l])
};
j.prototype.weekends=function(l){if(!this.month_exists(l)){return
}return this.months[l].where({is_weekend:true})
};
j.prototype.weekdays=function(l){if(!this.month_exists(l)){return
}return this.months[l].where({is_weekend:false})
};
j.prototype.special=function(l){if(!this.month_exists(l)){return
}return this.months[l].where({price_type:"special"})
};
j.prototype.get_updated_days=function(l){if(!this.month_exists(l)){return
}return this.months[l].where({updated:true})
};
j.prototype.clear_updated=function(l){var m;
m=this.get_updated_days(l);
return _.each(m,function(n){return n.unset("updated")
})
};
return j
})(Backbone.Collection)
},{}],10:[function(c,f,a){var d,h,b={}.hasOwnProperty,g=function(m,k){for(var j in k){if(b.call(k,j)){m[j]=k[j]
}}function l(){this.constructor=m
}l.prototype=k.prototype;
m.prototype=new l();
m.__super__=k.prototype;
return m
};
h=c("./model.coffee");
f.exports=d=(function(k){g(j,k);
function j(){return j.__super__.constructor.apply(this,arguments)
}j.prototype.jsonKey="calendar_rules";
j.prototype.url=function(){return"listings/"+(this.get("listing_id"))+"/calendar_rules"
};
return j
})(h)
},{"./model.coffee":20}],11:[function(f,b,k){var a,m,g,d,n,j,c,l={}.hasOwnProperty,h=function(r,p){for(var o in p){if(l.call(p,o)){r[o]=p[o]
}}function q(){this.constructor=r
}q.prototype=p.prototype;
r.prototype=new q();
r.__super__=p.prototype;
return r
};
d=f("./model.coffee");
g=f("../mixins/cleaning_pricing.coffee");
n=f("../mixins/typed_setter.coffee");
a=f("../mixins/cleaning_extra_fields.coffee");
b.exports=m=(function(r){var u,p,o,q;
h(s,r);
function s(){return s.__super__.constructor.apply(this,arguments)
}n(s);
a(s);
g(s);
s.prototype.jsonKey="cleaning_job";
s.prototype.url="cleaning_jobs";
q=-1;
o=1;
p=2;
u=["schedule_type","day_offset","start_time"];
s.prototype.defaults={start_time:s.randomStartTime()};
s.fromPreference=function(x,w,v){var y;
y=new this(_.pick(x.data(),u),v);
return y.set("reservation_code",w.confirmation_code)
};
s.canScheduleForReservations=function(w,v){return !!_.find(w,function(z){var x,y;
x=z.cleaning_jobs;
y=v.get("schedule_type");
if(j(z,y)){return false
}return !c(x,y)
})
};
s.fillInReservations=function(x,w){var v;
v=_.map(x,(function(y){return function(z){return y.fillInReservation(z,w)
}
})(this));
return _.filter(v,function(y){return !!y
})
};
s.fillInReservation=function(z,w){var y,v,x;
v=z.cleaning_jobs;
x=w.get("schedule_type");
if(c(v,x)){return null
}if(j(z,x)){return null
}y=this.fromPreference(w,z,{});
y.set("job_status",q);
v.add(y);
return y
};
s.prototype.isPending=function(){return this.get("job_status")===o
};
s.prototype.isCompleted=function(){return this.get("job_status")===p
};
s.prototype.isUnsynced=function(){return this.get("job_status")===q
};
return s
})(d);
j=function(p,o){return(o===m.SCHEDULE_TYPE_CHECKIN&&p.disable_before_clean_button)||(o===m.SCHEDULE_TYPE_CHECKOUT&&p.disable_after_clean_button)
};
c=function(o,p){return !!(o.find(function(q){return q.get("schedule_type")===p
}))
}
},{"../mixins/cleaning_extra_fields.coffee":4,"../mixins/cleaning_pricing.coffee":5,"../mixins/typed_setter.coffee":7,"./model.coffee":20}],12:[function(c,d,a){var h,g,b={}.hasOwnProperty,f=function(m,k){for(var j in k){if(b.call(k,j)){m[j]=k[j]
}}function l(){this.constructor=m
}l.prototype=k.prototype;
m.prototype=new l();
m.__super__=k.prototype;
return m
};
h=c("./cleaning_job.coffee");
d.exports=g=(function(k){f(j,k);
function j(){return j.__super__.constructor.apply(this,arguments)
}j.prototype.model=function(l){return new h(l.cleaning_job)
};
j.prototype.pruneUnsynced=function(){return this.each((function(l){return function(m){if(m.isUnsynced()){return l.remove(m)
}}
})(this))
};
return j
})(Backbone.Collection)
},{"./cleaning_job.coffee":11}],13:[function(f,b,h){var a,c,d,k,j={}.hasOwnProperty,g=function(o,m){for(var l in m){if(j.call(m,l)){o[l]=m[l]
}}function n(){this.constructor=o
}n.prototype=m.prototype;
o.prototype=new n();
o.__super__=m.prototype;
return o
};
d=f("./model.coffee");
k=f("../mixins/typed_setter.coffee");
a=f("../mixins/cleaning_extra_fields.coffee");
b.exports=c=(function(m){g(l,m);
function l(){return l.__super__.constructor.apply(this,arguments)
}k(l);
a(l);
l.prototype.jsonKey="cleaning_preference";
l.prototype.url=function(){return""+(this.listing.url())+"/cleaning_preferences/"+(this.get("schedule_type"))
};
l.FREQUENCY_MANUAL="on_demand";
l.FREQUENCY_AUTO="automatic";
l.extractFromListing=function(p,o){var n;
n=_.find(p.cleaningPreferences().models,function(q){return q.get("schedule_type")===o
});
if(!n){n=new this({schedule_type:o},{listing:p});
p.cleaningPreferences().add(n)
}return n
};
l.prototype.defaults={additional_info:"",bedrooms:null,bathrooms:null,rooms_to_clean:"",frequency:l.FREQUENCY_MANUAL,day_offset:l.DAY_OFFSET_SAME_DAY,entry_and_exit_instructions:"",entry_and_exit_keep_key:false,laundry_service:"none",laundry_loads:null,linen_location:"",refrigerator_cleaning:l.CLEAN_NOTHING,start_time:l.randomStartTime(),start_time_formatted:"",trash_disposal:""};
l.prototype.initialize=function(o,n){if(n==null){n={}
}l.__super__.initialize.call(this,o,n);
if(!n.listing){throw new Error("listing is a required option")
}this.listing=n.listing;
if(this.get("bedrooms")==null){this.set("bedrooms",this.listing.get("bedrooms")||1)
}if(this.get("bathrooms")==null){return this.set("bathrooms",this.listing.get("bathrooms"))
}};
l.prototype.automatic=function(){return this.get("frequency")===l.FREQUENCY_AUTO
};
return l
})(d)
},{"../mixins/cleaning_extra_fields.coffee":4,"../mixins/typed_setter.coffee":7,"./model.coffee":20}],14:[function(d,b,g){var k,c,a,h=function(l,m){return function(){return l.apply(m,arguments)
}
},j={}.hasOwnProperty,f=function(o,m){for(var l in m){if(j.call(m,l)){o[l]=m[l]
}}function n(){this.constructor=o
}n.prototype=m.prototype;
o.prototype=new n();
o.__super__=m.prototype;
return o
};
k=d("backbone");
c=d("./cleaning_preference.coffee");
b.exports=a=(function(l){f(m,l);
function m(){this.model=h(this.model,this);
return m.__super__.constructor.apply(this,arguments)
}m.prototype.initialize=function(o,n){if(n==null){n={}
}m.__super__.initialize.call(this,o,n);
if(!n.listing){throw new Error("listing is a required option")
}return this.listing=n.listing
};
m.prototype.model=function(o,n){n=_.extend({},n,{listing:this.listing});
return new c(o,n)
};
m.prototype.url=function(){return""+(this.listing.url())+"/cleaning_preferences"
};
return m
})(k.Collection)
},{"./cleaning_preference.coffee":13,backbone:"backbone"}],15:[function(f,c,j){var a,g,k,d,o,n,l,p,b,m={}.hasOwnProperty,h=function(u,r){for(var q in r){if(m.call(r,q)){u[q]=r[q]
}}function s(){this.constructor=u
}s.prototype=r.prototype;
u.prototype=new s();
u.__super__=r.prototype;
return u
};
d=f("./model.coffee");
a=f("./cleaning_price_estimate.coffee");
g=f("../mixins/cleaning_pricing.coffee");
n=f("../mixins/typed_setter.coffee");
k=["bedrooms","bathrooms","laundry_service","laundry_loads"];
o=["estimated_discount_amount","discount_percent","estimated_total_cost","estimated_subtotal_cost","linen_price"];
c.exports=a=(function(q){h(r,q);
function r(){return r.__super__.constructor.apply(this,arguments)
}n(r);
g(r);
r.fromPreference=function(w,v,u){var s;
s=l(k,w.get("cleaning_bed_types"));
u.app||(u.app=w);
return new r(_.pick(v.data(),s),u,w)
};
r.prototype.initialize=function(v,u){var w,s;
if(u==null){u={}
}r.__super__.initialize.call(this,v,u);
if(!u.listing){throw new Error("listing is a required option")
}w=u.app;
this.listing=u.listing;
setTimeout(((function(x){return function(){return p(x,w)
}
})(this)),0);
s=_.debounce(((function(x){return function(){return p(x,w)
}
})(this)),10);
return this.on("change",function(y){var z,x;
x=[];
for(z in y.changed){if(!(_.contains(o,z))){s();
break
}else{x.push(void 0)
}}return x
})
};
r.prototype.jsonKey="cleaning_price_estimate";
r.prototype.url=function(){return""+(this.listing.url())+"/cleaning_price_estimate"
};
r.prototype.bindToPreference=function(s,u){return this.listenTo(s,"change",(function(v){return function(){return v.updateFromPreference(s,u)
}
})(this))
};
r.prototype.unbindFromPreference=function(s){return this.stopListening(s)
};
r.prototype.updateFromPreference=function(u,v){var s;
s=l(k,v.get("cleaning_bed_types"));
return b(this,_.pick(u.attributes,s))
};
return r
})(d);
l=function(q,r){return q.concat(_.pluck(r,"key"))
};
p=function(r,s){var q;
q=l(k,s.get("cleaning_bed_types"));
r.fetch({data:_.pick(r.data(),q),processData:true,success:function(){return r.trigger("pull:complete")
}});
return r.trigger("pull:start")
};
b=function(r,q){return _.each(q,function(u,s){var v;
v=r.get(s);
if(v!=u){return r.set(s,u)
}})
}
},{"../mixins/cleaning_pricing.coffee":5,"../mixins/typed_setter.coffee":7,"./cleaning_price_estimate.coffee":15,"./model.coffee":20}],16:[function(c,b,g){var k,f,a,h=function(l,m){return function(){return l.apply(m,arguments)
}
},j={}.hasOwnProperty,d=function(o,m){for(var l in m){if(j.call(m,l)){o[l]=m[l]
}}function n(){this.constructor=o
}n.prototype=m.prototype;
o.prototype=new n();
o.__super__=m.prototype;
return o
};
k=c("backbone");
a=c("../mixins/sync.coffee");
b.exports=f=(function(m){d(l,m);
function l(){this.fetch=h(this.fetch,this);
return l.__super__.constructor.apply(this,arguments)
}l.prototype.parse=function(o,n){if(this.jsonKey&&o[this.jsonKey]&&o[this.jsonKey].length){return o[this.jsonKey]
}else{return this.getDummyObject()
}};
l.prototype._fetched=false;
l.prototype.fetch=function(n){var q,p,o;
if(n==null){n={}
}if(n.success){p=n.success
}q={success:function(s,r){s._fetched=true;
if(p!=null){return p.call(this,s,r)
}}};
o=_.extend({},n,q);
return l.__super__.fetch.call(this,o)
};
l.prototype.getDummyObject=function(){return[{listing_description:{locale:this.listing.get("locale")}}]
};
return l
})(k.Collection);
a(f)
},{"../mixins/sync.coffee":6,backbone:"backbone"}],17:[function(g,c,k){var a,b,p,j,f,m,o,d,r,q,n={}.hasOwnProperty,h=function(w,u){for(var s in u){if(n.call(u,s)){w[s]=u[s]
}}function v(){this.constructor=w
}v.prototype=u.prototype;
w.prototype=new v();
w.__super__=u.prototype;
return w
},l=[].slice;
q=g("underscore");
f=g("./model.coffee");
m=g("./place_recommendations.coffee");
p=g("./listing_description.coffee");
j=g("./listing_descriptions.coffee");
a=g("./cleaning_preferences.coffee");
o=function(s){return q.reduce(s,function(u,w,v){u[v]={listable:false,attributes:w};
return u
},{})
};
r=o({calendar:["availability"],pricing:["listing_price_native"],overview:["name","description"],photos:["photos"],address:["address"],listing:["beds","bathrooms","bedrooms"]});
d=o({details:["details"],terms:["terms"],guidebook:["guidebook"],experience:["experience"],cleaning:["cleaning"]});
c.exports=b=(function(u){h(s,u);
function s(){return s.__super__.constructor.apply(this,arguments)
}s.prototype.jsonKey="listing";
s.prototype.url=function(){return"listings/"+this.id
};
s.prototype.initialize=function(w,v){if(v==null){v={}
}s.__super__.initialize.call(this,w,v);
this.app=v.app;
this.listenTo(this,"change",this.updateListability);
this.listenTo(this,"change",this.updatePostListingRequirements);
this._cleaningPreferences=new a(v.cleaningPreferenceAttributes,{listing:this});
this._listingDescriptions=new j([this.getDummyInitialListingDescription()],{listing:this});
this._placeRecommendations=new m(v.placeRecommendations,{categories:v.placeCategories,app:this.app,listing:this});
this.listenTo(this._placeRecommendations,"remove change",this.updatePostListingRequirements);
this.listenTo(this._listingDescriptions,"remove change",this.updateListability);
return this.listenTo(this._listingDescriptions,"remove change",this.updatePostListingRequirements)
};
s.prototype.getDummyInitialListingDescription=function(){return new p({name:this.get("name"),access:this.get("access"),house_rules:this.get("house_rules"),interaction:this.get("interaction"),neighborhood_overview:this.get("neighborhood_overview"),notes:this.get("notes"),space:this.get("space"),summary:this.get("summary"),transit:this.get("transit")})
};
s.prototype.locationString=function(){if(this.get("user_defined_location")){return""+(this.get("lat"))+", "+(this.get("lng"))
}else{return this.fullAddress()
}};
s.prototype.fullAddress=function(){var v;
v=q.reject([this.get("street"),this.get("apt"),this.get("zipcode"),this.get("city"),this.get("state"),this.get("country")],function(w){return !w
});
return v.join(", ")
};
s.prototype.hasDetailsSectionBeenEdited=function(){var v;
v=["space","access","interaction","neighborhood_overview","transit","house_rules"];
return this.listingDescriptions().find(function(w){return q.some(v,function(x){return w.get(x)
})
})
};
s.prototype.updatePostListingRequirements=function(){var y,x,w,v;
if(!this.get("has_ever_been_available")){return
}v=[];
for(w in d){if(!n.call(d,w)){continue
}y=d[w];
x=this.isListable.apply(this,y.attributes);
if(y.listable!==x){y.listable=x;
if(this.app){v.push(this.app.trigger("complete_requirement",w,x))
}else{v.push(void 0)
}}else{v.push(void 0)
}}return v
};
s.prototype.updateListability=function(){var E,x,D,v,B,w,y,A,z,C;
w=0;
E=this.get("steps_remaining");
A=[];
for(v in r){if(!n.call(r,v)){continue
}x=r[v];
D=this.isListable.apply(this,x.attributes);
if(!D){w++
}if(x.listable!==D){x.listable=D;
A.push([v,D])
}}B=w!==E;
for(z=0,C=A.length;
z<C;
z++){y=A[z];
if(this.app){this.app.trigger("listability",y[0],y[1],B)
}}if(B){return this.set({steps_remaining:w})
}};
s.prototype.save=function(w,x,v){if(q.size(q.intersection(["lat","lng"],q.keys(this._changedSinceSave)))){q.extend(this._changedSinceSave,{user_defined_location:this.get("user_defined_location")})
}return s.__super__.save.apply(this,arguments)
};
s.prototype.isViewListable=function(v){var w;
w=r[v];
return this.isListable.apply(this,w.attributes)
};
s.prototype.currencySymbol=function(){return I18n.options.currencies[this.get("listing_native_currency")].symbol
};
s.prototype.isReadyToList=function(){var w,v,x;
return((w=this.get("extra_user_info"))!=null?(v=w.phone_number)!=null?v.verified:void 0:void 0)&&((x=this.get("extra_user_info"))!=null?x.has_profile_pic:void 0)&&!this.app.get("security_check_required")
};
s.prototype.isListable=function(){var x,w,y,v;
w=1<=arguments.length?l.call(arguments,0):[];
for(y=0,v=w.length;
y<v;
y++){x=w[y];
if(this[""+x+"Listable"]&&!this[""+x+"Listable"]()){return false
}}return true
};
s.prototype.listableStatus=function(){var y,x,w,v;
v=(function(){var z;
z=[];
for(w in r){if(!n.call(r,w)){continue
}y=r[w];
z.push(x=this.isListable.apply(this,y.attributes))
}return z
}).call(this);
return q.object(q.keys(r),v)
};
s.prototype.listing_price_nativeListable=function(){var v;
v=this.get("listing_price_native");
return parseInt(v,10)>=0
};
s.prototype.availabilityListable=function(){var v;
v=this.get("availability");
return v.type&&v.type!=="onetime"||((v.start!=null)&&(v.end!=null))
};
s.prototype.descriptionListable=function(){var v;
v=this.listingDescriptions().find(function(w){return w.get("summary")||w.get("space")
});
return v&&(v.validCount("summary")||v.validCount("space"))
};
s.prototype.nameListable=function(){var v;
v=this.listingDescriptions().find(function(w){return w.get("name")
});
return v&&v.validCount("name")
};
s.prototype.detailsListable=function(){return this.hasDetailsSectionBeenEdited()
};
s.prototype.termsListable=function(){return this.get("has_viewed_terms")
};
s.prototype.guidebookListable=function(){return this._placeRecommendations.length>0
};
s.prototype.experienceListable=function(){return this.get("experiences_offered")!=="none"
};
s.prototype.cleaningListable=function(){return this.get("has_viewed_cleaning")
};
s.prototype.photosListable=function(){return this.get("photos").length>=1
};
s.prototype.bathroomsListable=function(){return this.get("bathrooms")!=null
};
s.prototype.bedsListable=function(){return this.get("beds")!=null
};
s.prototype.bedroomsListable=function(){if(this.get("room_type")==="Entire home/apt"){return this.get("bedrooms")!=null
}else{return true
}};
s.prototype.addressListable=function(){return(this.get("user_defined_location")&&this.get("lat")&&this.get("lng"))||(this.get("is_location_exact")&&this.get("street"))
};
s.prototype.cleaningPreferences=function(){return this._cleaningPreferences
};
s.prototype.listingDescriptions=function(){return this._listingDescriptions
};
s.prototype.placeRecommendations=function(){return this._placeRecommendations
};
s.prototype.parse=function(w,x){var v;
v=s.__super__.parse.call(this,w,x);
return q.extend(v,{street_address_short:w.street_address_short})
};
s.prototype.isInstantBookEnabled=function(){return this.get("instant_booking_visibility")!==this.app.get("instant_book_off_string")
};
return s
})(f)
},{"./cleaning_preferences.coffee":14,"./listing_description.coffee":18,"./listing_descriptions.coffee":19,"./model.coffee":20,"./place_recommendations.coffee":22,underscore:"underscore"}],18:[function(c,d,a){var g,h,b={}.hasOwnProperty,f=function(m,k){for(var j in k){if(b.call(k,j)){m[j]=k[j]
}}function l(){this.constructor=m
}l.prototype=k.prototype;
m.prototype=new l();
m.__super__=k.prototype;
return m
};
h=c("./model.coffee");
d.exports=g=(function(j){f(k,j);
function k(){return k.__super__.constructor.apply(this,arguments)
}k.prototype.jsonKey="listing_description";
k.prototype.initialize=function(m,l){if(l==null){l={}
}return k.__super__.initialize.call(this,m,l)
};
k.prototype.attributeLengths={summary:{characters:{min:1,max:250}},name:{characters:{min:1,max:35}}};
k.prototype.urlSuffixFromMethod=function(l){if(l==="create"){return"/update"
}else{return k.__super__.urlSuffixFromMethod.call(this,l)
}};
k.prototype.url=function(){return""+(this.collection.url())+"/"+(this.get("locale"))
};
return k
})(h)
},{"./model.coffee":20}],19:[function(b,a,g){var f,j,d,h=function(l,m){return function(){return l.apply(m,arguments)
}
},k={}.hasOwnProperty,c=function(o,m){for(var l in m){if(k.call(m,l)){o[l]=m[l]
}}function n(){this.constructor=o
}n.prototype=m.prototype;
o.prototype=new n();
o.__super__=m.prototype;
return o
};
f=b("./collection.coffee");
j=b("./listing_description.coffee");
a.exports=d=(function(m){c(l,m);
function l(){this.model=h(this.model,this);
return l.__super__.constructor.apply(this,arguments)
}l.prototype.jsonKey="listing_descriptions";
l.prototype.initialize=function(o,n){if(n==null){n={}
}l.__super__.initialize.call(this,o,n);
if(!n.listing){throw new Error("listing is a required option")
}return this.listing=n.listing
};
l.prototype.model=function(o,n){return new j(o,_.extend({},n,{listing:this.listing}))
};
l.prototype.comparator=function(n){return n.get("id")
};
l.prototype.url=function(){return""+(this.listing.url())+"/descriptions"
};
return l
})(f)
},{"./collection.coffee":16,"./listing_description.coffee":18}],20:[function(f,c,h){var b,j,d,a,m,k=function(n,o){return function(){return n.apply(o,arguments)
}
},l={}.hasOwnProperty,g=function(q,o){for(var n in o){if(l.call(o,n)){q[n]=o[n]
}}function p(){this.constructor=q
}p.prototype=o.prototype;
q.prototype=new p();
q.__super__=o.prototype;
return q
};
m=f("underscore");
a=f("../mixins/sync.coffee");
b=f("../mixins/attribute_lengths.coffee");
j=f("../../../models/base.coffee");
c.exports=d=(function(n){g(o,n);
function o(){this.toJSON=k(this.toJSON,this);
this._extractChanges=k(this._extractChanges,this);
return o.__super__.constructor.apply(this,arguments)
}a(o);
b(o);
o.prototype._changedSinceSave={};
o.prototype._changeTrackingEnabled=true;
o.prototype.initialize=function(q,p){o.__super__.initialize.call(this,q,p);
return this._resetChangeTracking()
};
o.prototype._extractChanges=function(p){var q;
if(!m.isObject(p)){return p
}q={};
m.each(m.keys(p),(function(r){return function(s){if((!p[s]&&r.attributes[s])||((p[s]!=null)&&(r.attributes[s]!==p[s]))){return q[s]=p[s]
}}
})(this));
return q
};
o.prototype.set=function(r,s,q){var p;
if(m.isObject(r)){r=this._extractChanges(r)
}p=o.__super__.set.call(this,r,s,q);
if(this._changeTrackingEnabled){m.extend(this._changedSinceSave,this.changed)
}return p
};
o.prototype.hasChangedSinceSave=function(){return !m(this._changedSinceSave).isEmpty()
};
o.prototype.save=function(s,r,x){var u,q,w,y,v,p;
if(m.isObject(s)||s===null){u=this._extractChanges(s);
x=r
}else{u={};
if(s!=null){u[s]=r
}}x=x?m.clone(x):{};
w=[];
if(x.syncEverything){u=this.data();
w=m.keys(u)
}else{w=m.union(m.keys(u||{}),m.keys(this._changedSinceSave))
}if(x.include!=null){w=w.concat(x.include)
}if(w.length>0){p=(function(z){return function(C){var D,B,A;
z.trigger("saving:"+C);
A=[];
for(D=0,B=w.length;
D<B;
D++){s=w[D];
A.push(z.trigger("saving:"+C+":"+s))
}return A
}
})(this);
if(!x.silent){p("start")
}v=x.success;
q=x.error;
x.success=(function(z){return function(){if(!x.silent){p("success")
}if(v){return v.apply(z,arguments)
}}
})(this);
x.error=(function(z){return function(){var A;
if(!x.silent){A={key:"network_error"};
z.trigger("saving:error",A)
}if(q){return q.apply(z,arguments)
}}
})(this);
y=this._modifiedBackboneSave(u,x)
}else{if(!x.silent){this.trigger("saving:no_changes")
}}this._resetChangeTracking();
return y
};
o.prototype.fetch=function(p){var q;
if(p==null){p={}
}q=p.success;
p.success=function(u,r,s){u._resetChangeTracking();
if(q){return q.call(u,u,r,s)
}};
return o.__super__.fetch.call(this,p)
};
o.prototype._modifiedBackboneSave=function(s,w,r){var q,v,x,u,p=this.attributes;
if(s==null||typeof s==="object"){q=s;
r=w
}else{(q={})[s]=w
}if(q&&(!r||!r.wait)&&!this.set(q,r)){return false
}r=m.extend({validate:true},r);
if(!this._validate(q,r)){return false
}if(q&&r.wait){this.attributes=m.extend({},p,q)
}if(r.parse===void 0){r.parse=true
}v=r.success;
r.success=function(A,C,z){A.attributes=p;
var B=A.parse(C,z);
if(z.wait){B=m.extend(q||{},B)
}var y=function(){var D;
var E=A._changeTrackingEnabled;
try{A._changeTrackingEnabled=false;
D=A.set(B,z)
}finally{A._changeTrackingEnabled=E
}return D
};
if(m.isObject(B)&&!y()){return false
}if(v){v(A,C,z)
}};
x=this.isNew()?"create":(r.patch?"patch":"update");
if(x==="patch"){r.attrs=q
}u=this.sync(x,this,r);
if(q&&r.wait){this.attributes=p
}return u
};
o.prototype._resetChangeTracking=function(){return this._changedSinceSave={}
};
o.prototype.toJSON=function(p){var r,q;
if(p.syncEverything){return this.data()
}r=m.clone(this._changedSinceSave);
if(p.include!=null){m.extend(r,m.pick(this.data(),p.include))
}if(this.jsonKey){q={};
q[this.jsonKey]=r;
r=q
}return r
};
return o
})(j)
},{"../../../models/base.coffee":91,"../mixins/attribute_lengths.coffee":3,"../mixins/sync.coffee":6,underscore:"underscore"}],21:[function(d,f,a){var j,h,c=function(k,l){return function(){return k.apply(l,arguments)
}
},b={}.hasOwnProperty,g=function(n,l){for(var k in l){if(b.call(l,k)){n[k]=l[k]
}}function m(){this.constructor=n
}m.prototype=l.prototype;
n.prototype=new m();
n.__super__=l.prototype;
return n
};
j=d("./model.coffee");
f.exports=h=(function(k){g(l,k);
function l(){this.toJSON=c(this.toJSON,this);
return l.__super__.constructor.apply(this,arguments)
}l.prototype.jsonKey="place_recommendation";
l.prototype.initialize=function(n,m){if(m==null){m={}
}this.listing=m.listing;
this.listing.listenTo(this,"sync",this.listing.updatePostListingRequirements);
return l.__super__.initialize.call(this,n,m)
};
l.prototype.urlSuffixFromMethod=function(m){return{read:"",update:"/"+this.id+"/update","delete":"/"+this.id+"/delete",create:""}[m]
};
l.prototype.attributeLengths={reason:{characters:{min:1,max:200}}};
l.prototype.toJSON=function(){var m;
m=l.__super__.toJSON.apply(this,arguments);
m.reference=m.place_recommendation["reference"];
delete m.place_recommendation["reference"];
return m
};
l.prototype.url=function(){return""+(this.listing.url())+"/place_recommendations/"
};
l.prototype.street_address=function(){var m;
m=this.attributes.place;
if(m.source==="Google Places"){if(m.street_number){return""+m.street_number+" "+m.address
}else{return m.address
}}else{return""
}};
l.prototype.formatted_address=function(){var o,n,p,m;
m=this.attributes.place;
p=["city","state","zipcode"];
o=this.street_address();
n=_.map(p,function(q){return m[q]
}).filter(Boolean).join(", ");
if(o){return o+", "+n
}else{return n
}};
l.prototype.categoryLong=function(){var m;
m=this.attributes.category;
return _.findWhere(this.collection.categories,{name:m}).category
};
l.prototype.iconClass=function(){var n,m;
n=this.attributes.category;
m=this.collection.iconForCategory(n);
return"icon-"+m
};
l.prototype.verticalOffset=function(){return 36*this.collection.categoryOrderInSprite[this.get("category")]
};
return l
})(j)
},{"./model.coffee":20}],22:[function(b,a,d){var k,j,f,g=function(l,m){return function(){return l.apply(m,arguments)
}
},h={}.hasOwnProperty,c=function(o,m){for(var l in m){if(h.call(m,l)){o[l]=m[l]
}}function n(){this.constructor=o
}n.prototype=m.prototype;
o.prototype=new n();
o.__super__=m.prototype;
return o
};
k=b("backbone");
j=b("./place_recommendation.coffee");
a.exports=f=(function(m){c(l,m);
function l(){this.model=g(this.model,this);
return l.__super__.constructor.apply(this,arguments)
}l.prototype.initialize=function(o,n){if(n==null){n={}
}l.__super__.initialize.call(this,o,n);
if(!n.listing){throw new Error("listing is a required option")
}this.app=n.app;
this.listing=n.listing;
this.categories=n.categories;
return this._categoryToIconMap=this.app.get("guidebook_data").category_to_icon
};
l.prototype.iconForCategory=function(n){return this._categoryToIconMap[n]
};
l.prototype.categoryOrderInSprite={bar:"0",cafe:"1",restaurant:"6",kid:"3",tourism:"7",store:"8",groceries:"4",art:"2",wifi:"9",other:"5"};
l.prototype.model=function(o,n){return new j(o,_.extend({},n,{listing:this.listing}))
};
l.prototype.comparator=function(n){return n.get("id")
};
return l
})(k.Collection)
},{"./place_recommendation.coffee":21,backbone:"backbone"}],23:[function(n,d,A){var x,g,h,f,v,c,s,w,o,u,q,B,l,m,p,a,k,z,b,j,r={}.hasOwnProperty,y=function(F,D){for(var C in D){if(r.call(D,C)){F[C]=D[C]
}}function E(){this.constructor=F
}E.prototype=D.prototype;
F.prototype=new E();
F.__super__=D.prototype;
return F
};
j=/^\/manage-listing\/\d+/;
u=n("./views/instant_book_v3_view.coffee");
x=n("./views/amenities_view.coffee");
h=n("./views/chrome_view.coffee");
m=n("./views/nav_view.coffee");
w=n("./views/guest_experiences_view.coffee");
o=n("./views/guidebook_view.coffee");
k=n("./views/pricing_view.coffee");
p=n("./views/overview_view.coffee");
s=n("./views/details_view.coffee");
q=n("./views/listing_view.coffee");
b=n("./views/terms_view.coffee");
v=n("./views/cleaning_view.coffee");
B=n("./views/location_view.coffee");
a=n("./views/photos_view.coffee");
f=n("./views/cleaning_preferences_view.coffee");
c=n("./views/complete_profile_view.coffee");
g=n("./views/calendar_view.coffee");
l=n("./views/ny_legal_view.coffee");
d.exports=z=(function(D){y(C,D);
function C(){return C.__super__.constructor.apply(this,arguments)
}C.prototype.routes={"":"navigateToBestRoute",overview:"overview",details:"details",calendar:"calendar",pricing:"pricing",guidebook:"guidebook",amenities:"amenities",address:"address","address#cleaning-schedule-confirm-address":"address","address#cleaning-preference-confirm-address":"address",listing:"listing",terms:"terms",photos:"photos",complete:"complete",experience:"experience","instant-book":"instant-book","cleaning-preferences":"cleaning-preferences","cleaning-preferences#after-checkout":"cleaning-preferences","cleaning-preferences#after-checkout?reservation_id=:id":"cleaning-preferences","cleaning-preferences?reservation_id=:id":"cleaning-preferences","cleaning-schedule":"cleaning-schedule"};
C.prototype.initialize=function(E){this.app=E.app;
this.app.router=this;
this.chromeView=new h({el:"#js-manage-listing",app:this.app}).render();
this.app.navView=new m({el:"#js-manage-listing-nav",app:this.app,router:this,model:this.app.listing});
this.initRouteLookup();
this.app.chromeView=this.chromeView;
Backbone.history.start({pushState:true,hashChange:true,root:"/manage-listing/"+(this.app.listing.get("id"))+"/"});
if(!this.hasPushState()){return Backbone.history.loadUrl(window.location.pathname)
}};
C.prototype.hasPushState=function(){return !!window.history.pushState
};
C.prototype.getBestRoute=function(){if(this.app.listing.get("has_availability")||!this.app.listing.isViewListable("calendar")||!this.app.listing.get("has_ever_been_edited")){return"calendar"
}else{if(!this.app.listing.isViewListable("pricing")){return"pricing"
}else{if(!this.app.listing.isViewListable("overview")){return"overview"
}else{if(!this.app.listing.isViewListable("photos")){return"photos"
}else{if(!this.app.listing.isViewListable("address")){return"address"
}else{if(!this.app.listing.isViewListable("listing")){return"listing"
}else{if(!this.app.listing.get("has_ever_been_available")||this.app.get("security_check_required")){return"complete"
}else{return"calendar"
}}}}}}}};
C.prototype.navigateToBestRoute=function(){var E;
E=location.search;
if((E.indexOf("listnow")===1)&&this.app.listing.isReadyToList()){return this.complete({listNow:true})
}else{return this.navigate(this.getBestRoute(),{trigger:true,replace:true})
}};
C.prototype.navigateToInstantBook=function(){return this.navigate("instant-book",{trigger:true,replace:true})
};
C.prototype.navigateToVerify=function(E){return window.location.href="/verify?from=manage-listing&hosting_id="+E
};
C.prototype.experience=function(){var E;
if(this.app.get("enable_guest_experiences")){E=new w({app:this.app,model:this.app.listing,experienceData:this.app.get("experience_data")});
return this.updateContent(E)
}else{return this.navigateToBestRoute()
}};
C.prototype.guidebook=function(){var E;
E=new o({app:this.app,model:this.app.listing});
return this.updateContent(E)
};
C.prototype.calendar=function(){var E;
E=new g({app:this.app,model:this.app.listing});
return this.updateContent(E)
};
C.prototype.pricing=function(){var E;
E=new k({app:this.app,model:this.app.listing});
return this.updateContent(E)
};
C.prototype.overview=function(){var E;
E=new p({app:this.app,router:this,model:this.app.listing});
return this.updateContent(E)
};
C.prototype.details=function(){var E;
E=new s({app:this.app,router:this,model:this.app.listing});
return this.updateContent(E)
};
C.prototype.amenities=function(){var E;
E=new x({app:this.app,model:this.app.listing});
return this.updateContent(E)
};
C.prototype.address=function(){var G,J,I,H,F,E;
F=window.location.href;
H=/#cleaning-schedule-confirm-address/.test(F);
J=/#cleaning-preference-confirm-address/.test(F);
G=H||J;
if(H){I="cleaning-schedule"
}else{if(J){I="cleaning-preferences"
}}E=new B({app:this.app,model:this.app.listing,confirmAddressFlow:G,returnFragment:I});
return this.updateContent(E)
};
C.prototype["instant-book"]=function(){var E;
if(this.app.listing.get("instant_book_eligible")){E=new u({app:this.app,model:this.app.listing,trackingData:{mainSection:"instant_book"}});
return this.updateContent(E)
}else{return this.navigate("calendar",{trigger:true,replace:true})
}};
C.prototype.listing=function(){var E;
E=new q({app:this.app,model:this.app.listing});
return this.updateContent(E)
};
C.prototype.terms=function(){var E;
E=new b({app:this.app,model:this.app.listing});
return this.updateContent(E)
};
C.prototype.photos=function(){var E;
E=new a({app:this.app,model:this.app.listing});
return this.updateContent(E)
};
C.prototype["cleaning-schedule"]=function(){if(!this.app.get("show_cleaning")){this.navigateToBestRoute();
return
}return this.updateContent(new v({app:this.app,model:this.app.listing,router:this}))
};
C.prototype["cleaning-preferences"]=function(){var H,I,E,J,G,F;
if(!this.app.get("show_cleaning")){this.navigateToBestRoute();
return
}F=window.location.href;
I=F.match(/#after-checkout/);
H=!!I;
J=F.match(/\?.*reservation_id=(\d+)/);
E=J&&J[1];
G=null;
if(E&&E.match(/^\d+$/)){G=parseInt(E)
}return this.updateContent(new f({app:this.app,model:this.app.listing,afterCheckoutTab:H,reservationId:G}))
};
C.prototype.complete=function(F){var G,H,E;
if(F==null){F={}
}G=this.getBestRoute();
if(G!=="complete"){this.navigate(G,{trigger:true,replace:true});
return
}if(F){H=F.listNow
}E=new c({app:this.app,model:this.app.listing,router:this.app.router,listNow:H});
return this.updateContent(E)
};
C.prototype.backgroundViews={};
C.prototype.updateContent=function(E){var F;
this.updateCurrentRoute(this.findCurrentRoute());
if(this.$body==null){this.$body=$("body")
}if(this.currentView&&!this.comingFromLightbox){if(this.currentView.__hasRendered){this.currentView.cleanup()
}}if(E.isBackgroundView()){if(this.backgroundViews[E.id]){E=this.backgroundViews[E.id]
}else{this.backgroundViews[E.id]=E
}}if((F=this.currentView)!=null?F.bodyClassName:void 0){this.$body.removeClass(this.currentView.bodyClassName)
}this.$body.addClass(E.bodyClassName);
if(E.isRenderedBackgroundView()){this.chromeView.updateContent(E.el);
E.trigger("preservedView:didDisplay")
}else{E.render();
this.chromeView.updateContent(E.el);
E.trigger("render:dom_inserted")
}this.currentView=E;
return this.showNYLegalIfNeeded()
};
C.prototype.showNYLegalIfNeeded=function(){if(this.shouldShowNYLegal()){return this.showNYLegal()
}};
C.prototype.shouldShowNYLegal=function(){return this.app.listing.get("state")==="NY"&&this.app.listing.isViewListable("address")&&!this.app.listing.get("has_agreed_to_legal_terms")&&!$("body").hasClass("modal-open")
};
C.prototype.showNYLegal=function(){var E;
E=new l({model:this.app.listing});
return E.render()
};
C.prototype.matchingRoute=function(E){return _.find(Backbone.history.handlers,function(F){if(F.route.test(E)){return F
}})
};
C.prototype.matchesAnyRoute=function(E){return this.matchingRoute(E)!=null
};
C.prototype.initRouteLookup=function(){var I,G,F,H,E;
this._routeByRegExps={};
H=this.routes;
E=[];
for(F in H){if(!r.call(H,F)){continue
}I=H[F];
G=this._routeToRegExp(F);
E.push(this._routeByRegExps[G.toString()]=I)
}return E
};
C.prototype.findCurrentRoute=function(F){var E;
if(F==null){F=Backbone.history.fragment
}E=this.matchingRoute(F);
return this._routeByRegExps[E.route.toString()]
};
C.prototype.updateCurrentRoute=function(E){this.previousRoute=this.currentRoute;
this.currentRoute=E;
this.previousFragment=this.currentFragment;
this.currentFragment=Backbone.history.fragment;
this.firstRoute=this.firstFragment==null;
if(this.firstFragment==null){return this.firstFragment=this.currentFragment
}};
C.prototype.handleLinkClick=function(E){var F;
F=E.replace(j,"");
this.navigate(F,{trigger:true});
return this
};
C.prototype.shouldInterceptClick=function(F){var E;
E=F.currentTarget.getAttribute("href");
return !(window.modifierKey&&j.test(E))
};
C.prototype.followClickIfShould=function(F){var E;
if(this.shouldInterceptClick(F)){F.preventDefault();
E=$(F.currentTarget).attr("href");
return this.handleLinkClick(E)
}};
return C
})(Backbone.Router)
},{"./views/amenities_view.coffee":32,"./views/calendar_view.coffee":39,"./views/chrome_view.coffee":40,"./views/cleaning_preferences_view.coffee":47,"./views/cleaning_view.coffee":50,"./views/complete_profile_view.coffee":51,"./views/details_view.coffee":54,"./views/guest_experiences_view.coffee":58,"./views/guidebook_view.coffee":64,"./views/instant_book_v3_view.coffee":69,"./views/listing_view.coffee":71,"./views/location_view.coffee":72,"./views/nav_view.coffee":75,"./views/ny_legal_view.coffee":77,"./views/overview_view.coffee":78,"./views/photos_view.coffee":81,"./views/pricing_view.coffee":82,"./views/terms_view.coffee":85}],24:[function(c,d,b){var a;
d.exports=a=(function(){function f(){}f.prototype.onSaveStart=function(g){return this._adjustProgressElementCountBy(g,1,1,function(h){h.addClass("currently-saving");
h.find("h5").html(t("shared.Saving"));
h.finish();
return h.fadeIn("slow")
})
};
f.prototype.onSaveSuccess=function(g){return this._adjustProgressElementCountBy(g,-1,0,(function(h){return function(j){return h._updateCompletedProgressElement(j,t("shared.Saved!"))
}
})(this))
};
f.prototype.onSaveFailure=function(g){return this._adjustProgressElementCountBy(g,-1,0,(function(h){return function(j){return h._updateCompletedProgressElement(j,t("shared.Saved!"))
}
})(this))
};
f.prototype._adjustProgressElementCountBy=function(h,k,m,n){var l,g,j;
j=this._progressElementForSectionElement(h);
if(j.length>0){g=j.data("pending-count")||0;
l=g+k;
j.data("pending-count",l);
if(l===m){return n(j)
}}};
f.prototype._progressElementForSectionElement=function(g){return g.children(".js-saving-progress")
};
f.prototype._updateCompletedProgressElement=function(g,h){g.removeClass("currently-saving");
g.find("h5").html(h);
g.finish();
return g.fadeOut({duration:3000,done:function(){return $(this).hide()
}})
};
return f
})()
},{}],25:[function(b,a,d){var f,h,j,k,g,l={}.hasOwnProperty,c=function(p,n){for(var m in n){if(l.call(n,m)){p[m]=n[m]
}}function o(){this.constructor=p
}o.prototype=n.prototype;
p.prototype=new o();
p.__super__=n.prototype;
return p
};
f=b("../../views/base_view.coffee");
a.exports=h=(function(n){c(m,n);
function m(){return m.__super__.constructor.apply(this,arguments)
}m.prototype.defaults=function(){return{c1:"manage_listing_v2",c8:this.model.get("has_availability")?"active":"not_active"}
};
m.prototype.initialize=function(){this.app=this.options.app;
return m.__super__.initialize.apply(this,arguments)
};
m.prototype.track=function(o){_.extend(o,this.defaults());
return Airbnb.Tracking.logEvent({event_name:"new_manage_listing",event_data:o})
};
m.prototype.track2=function(o){return Airbnb.Tracking.logEvent({event_name:"manage_listing",event_data:o})
};
m.prototype.events={"click [data-track]":"navClick","click .open-preview":"previewClick","click #js-list-space-button":"lysClick","click .calendar-image":"calendarChoiceClick","click .back-to-availability":"availabilityClick","click .disabled-month":"availabilityClick","focus .availability-start":"startFocus","change .availability-start":"startChange","focus .availability-end":"endFocus","change .availability-end":"endChange","click .onetime-dates .btn":"oneTimeSave","focus #listing_price_native":"nightlyFocus","change #listing_price_native":"nightlyChange","click .curr-selector button":"currencyFocus","click .section-standard-price .picker-item a":"currencyChange","change #guests-included-select select":"guestsChange","focus #guests-included-select select":"guestsFocus","click #set-prices":"clickMonthlyWeekly","change .checkbox-group input[type=checkbox]":"checkboxGroupChange","focus .checkbox-group input[type=text]":"checkboxGroupInputFocus","change .checkbox-group input[type=text]":"checkboxGroupInputChange","display #js-section-details":"clickAddDetails","focus .description-view input":"focusDescriptionField","focus .description-view textarea":"focusDescriptionField","input:limit .description-view input":"hitLimitDescriptionField","input:limit .description-view textarea":"hitLimitDescriptionField","change .description-view input":"changeDescriptionField","change .description-view textarea":"changeDescriptionField","input:limit .description-view input":"limitDescriptionField","input:limit .description-view textarea":"limitDescriptionField","click #js-edit-details-rooms":"editRooms","change #js-details-amenities input":"toggleAmenities","focus .section-confirmed-guests textarea":"detailsForConfirmedGuestsFields","photos:upload .photos-view":"photoUpload","click #photo-uploader":"addPhotoClick","focus .photo-item textarea":"editPhotoCaption","click .photo-item a[rel=modal]":"photoPreviewClick","dragstart .photo-item":"photoDrag","delete:click .photo-item":"deletePhotoModal","delete:confirm .photo-item":"deletePhotoConfirm","click .facebook-connect":"fbConnect","click #upload-profile-pic":"uploadProfilePic","click #phone-modal-add":"addPhoneClick","click #phone-modal-verify":"verifyPhoneClick","click #complete-list-it":"completeListIt","click .manage-listing-footer a":"footerClick","click #js-learn-more":"detailsLearnMore","focus input[name=license]":"focusLicense","change input[name=license]":"changeLicense","change #availability-dropdown select":"availabilityUpdate","focus #directions":"focusDirectionsField","change #directions":"changeDirectionsField","focus #js-address-fields-form input":"focusAddressField","change #js-address-fields-form input":"changeAddressField","focus #js-address-fields-form select":"focusSelectField","change #js-address-fields-form select":"changeSelectField","click input[name=address-choice]":"trackSuggestedAddressChoiceClick","click #js-address-next-btn":"trackAddressNavNextButtonClick","click .address-nav-header small a":"trackAddressNavClicks","change #ib-who-can-book-select select":"changeInstantBookSelect","change #ib-advanced-notice-select select":"changeInstantBookSelect","change #ib-lead-time-hourly-select select":"changeInstantBookSelect","change #ib-enabled":"changeInstantBookEnabled","focus textarea.welcome":"focusWelcomeMessage","click #ibv3-modal-trigger":"clickIBV3Modal","click .js-set-advanced-prices":"clickSetCustomPrices","click .js-edit-advanced-prices":"clickEditCustomPrices","click .js-save-advanced-prices":"clickApplyCustomPrices"};
m.prototype.bindings=function(){this.app.on("profile_photo",this.profilePhotoSuccess,this);
this.app.on("listability",this.navCompleteOrder,this);
this.app.on("listability",this.trackSectionComplete,this);
this.app.on("tracking:gingersnap",this.trackGingerSnap,this);
this.app.on("tracking:tax_id_scanner_match",this.taxIdScannerMatch,this);
this.phoneNumberWidget();
this.app.on("impression",this.trackImpressions,this);
this.listenTo(this.model,"saving:error",this.trackSavingErrors,this);
this.listenTo(this.app,"listing_space",this.trackListingSpace,this);
this.listenTo(this.app,"tracking:pro_photo_tooltip_impression",this.trackProPhotoTooltip,this);
this.listenTo(this.model,"tracking:pro_photo_apply_now_click",this.trackProPhotoClick,this);
this.listenTo(this.app,"section:impressions",this.trackSectionImpressions,this);
this.listenTo(this.app,"experience:view",this.viewGuestExperience,this);
this.listenTo(this.app,"experience:click",this.selectGuestExperience,this);
this.listenTo(this.app,"address:edit_address",this.trackAddressNavClicks);
this.listenTo(this.app,"address:pane_impression",this.trackAddressPaneImpressions);
this.listenTo(this.app,"tracking:map_drag",this.trackMapDrag);
this.listenTo(this.app,"address:autocomplete_used",this.trackAutocompleteUse);
this.listenTo(this.app,"guidebook:impression",this.trackGuidebookImpressions);
this.listenTo(this.app,"guidebook:new_entry",this.trackNewGuidebookEntry);
this.listenTo(this.app,"calendar_sync",this.trackCalendarSyncClicks);
this.listenTo(this.app,"tracking:ib_ftue",this.trackInstantBookFTUE);
return this.listenTo(this.app,"tracking:ib_enabled_ftue",this.trackInstantBookEnabledFTUE)
};
m.prototype.trackSectionImpressions=function(o){return this.track({c2:o.mainSection,c3:o.subSection,c4:"impressions",c5:o.experiment,c6:"new_ml"})
};
m.prototype.instantBookOrDetailsView=function(){if(window.location.pathname.match(/instant-book/)){return"instant_book"
}else{return"details"
}};
m.prototype.focusInstantBookDropdown=function(p){var o;
o=$(p.currentTarget);
return this.track({c2:this.instantBookOrDetailsView(),c3:"instant_book",c4:""+(o.attr("name"))+"_focus"})
};
m.prototype.focusWelcomeMessage=function(p){var o;
o=$(p.currentTarget);
return this.track2({page:"instant_book",section:"welcome_message",operation:"focus",id_listing:this.model.get("id")})
};
m.prototype.clickIBV3Modal=function(p){var o;
o=$(p.currentTarget);
return this.track2({page:"instant_book",section:"what_your_guest_sees",operation:"click",id_listing:this.model.get("id")})
};
m.prototype.changeInstantBookEnabled=function(p){var o;
o=$(p.currentTarget);
return this.track2({page:"instant_book",section:"instant_book_on_off",operation:"click",id_listing:this.model.get("id"),on_or_off:o.is(":checked")?"on":"off"})
};
m.prototype.changeInstantBookSelect=function(p){var o;
o=$(p.currentTarget);
return this.track2({page:"instant_book",section:o.parent().parent().attr("id"),operation:"select",id_listing:this.model.get("id"),instant_booking_allowed:o.val()})
};
m.prototype.trackProPhotoTooltip=function(){return this.track({c2:"photos",c3:"pro_photo_tooltip_impression"})
};
m.prototype.trackProPhotoClick=function(){return this.track({c2:"photos",c3:"pro_photo_apply_now_click"})
};
m.prototype.trackSavingErrors=function(s){var q,p,r,o;
p=s!=null?(r=s.key)!=null?r.toString():void 0:void 0;
q=s!=null?(o=s.errorMsg)!=null?o.toString():void 0:void 0;
return this.track({c2:"error",c3:"error_impression",c4:p,c5:q})
};
m.prototype.trackListingSpace=function(o){return this.track({c2:"listing_space",c3:o})
};
m.prototype.trackImpressions=function(o){if(((o!=null?typeof o.getTrackingKey==="function"?o.getTrackingKey():void 0:void 0)!=null)){return this.track({c2:"impressions",c3:o.getTrackingKey()})
}};
m.prototype.trackAutocompleteUse=function(){return this.track({c2:"address_v3",c3:"autocomplete_option_click",c4:this.model.get("country")})
};
m.prototype.getAddressData=function(){var o,p;
o={country:this.model.get("country"),street:this.model.get("street"),city:this.model.get("city"),state:this.model.get("state"),zipcode:this.model.get("zipcode"),apt:this.model.get("apt")};
p=[""+o.apt+", "+o.street+", "+o.city+", ",""+o.state+", "+o.zipcode+", "+o.country].join("");
return _.extend(o,{entireAddress:p})
};
m.prototype.trackMapDrag=function(){return this.track({c2:"address_v3",c3:"map_drag"})
};
m.prototype.trackAddressNavNextButtonClick=function(o){if(!$(o.currentTarget).hasClass("disabled")){return this.trackAddressNextClick(o)
}};
m.prototype.trackSuggestedAddressChoiceClick=function(p){var o;
o=$(p.currentTarget).val();
return this.track({c2:"address_v3",c3:"suggested_address_choice",c4:o})
};
m.prototype.trackAddressPaneImpressions=function(){var o;
o=this.getAddressData();
return _.defer((function(p){return function(){return p.track({c2:"address_v3",c3:"impressions",c4:""+(p.$("#js-address-container").data("pane"))+"_imp",c5:o.country,c6:o.street,c7:o.city,c8:o.state,c9:o.zipcode,c10:o.entireAddress})
}
})(this))
};
m.prototype.trackAddressNextClick=function(){return this.track({c2:"address_v3",c3:"next_click",c4:""+(this.$("#js-address-container").data("pane"))+"_next"})
};
m.prototype.trackAddressNavClicks=function(r){var o,q,p,s;
p=$(r.currentTarget).data("event-name");
o=this.getAddressData();
s=this.$("#js-address-container").data("pane");
if(p==="edit_address_click"){q=""+s+"_edit"
}return this.track({c2:"address_v3",c3:p,c4:q,c5:o.country,c6:o.street,c7:o.city,c8:o.state,c9:o.zipcode,c10:o.entireAddress})
};
m.prototype.focusDirectionsField=function(){return this.track({c2:"address_v3",c3:"details",c4:"directions_focus"})
};
m.prototype.changeDirectionsField=function(o){return this.track({c2:"address_v3",c3:"details",c4:"directions_change",c5:$(o.currentTarget).val().length})
};
m.prototype.trackSectionComplete=function(p,q,o){if(q&&o){return this.track({c2:"step_complete",c3:""+p+"_complete"})
}};
m.prototype.navCompleteOrder=function(q,r,p){var o;
if(p){o=this.model.listableStatus();
return this.track({c2:"nav_complete_order",c3:""+q+"_complete",c4:o.calendar?"calendar_complete":"calendar_incomplete",c5:o.description?"description_complete":"description_incomplete",c6:o.photos?"photos_complete":"photos_incomplete",c7:o.details?"details_complete":"details_incomplete"})
}};
m.prototype.navClick=function(r){var p,q,o;
p=$(r.currentTarget).data("track");
q=this.model.get("has_ever_been_available")?"post_list":"pre_list";
o=this.model.listableStatus();
return this.track({c2:"navigation",c3:""+q+"_"+p+"_click",c4:o[p]})
};
m.prototype.availabilityUpdate=function(o){return this.track({c2:"visibility_toggle",c3:"toggle_"+($(o.currentTarget).val())+"_click"})
};
m.prototype.previewClick=function(o){this.track({c2:"preview",c3:"preview_click",c4:this.app.router.currentRoute});
return this.track(_.extend(this.completeness(),{c2:"preview",c3:"preview_complete_click"}))
};
m.prototype.lysClick=function(p){var o;
o=$(p.currentTarget);
return this.track({c2:"navigation",c3:"list_space_click",c4:o.hasClass("disabled")?"not_success":"success",c5:this.model.get("steps_remaining")})
};
m.prototype.completeness=function(){var o;
o=this.model.view_requirements;
return{c4:o.calendar.listable?"calendar_complete":"calendar_not_complete",c5:o.description.listable?"description_complete":"description_not_complete",c6:o.photos.listable?"photos_complete":"photos_not_complete",c7:o.details.listable?"details_complete":"details_not_complete"}
};
m.prototype.calendarChoiceClick=function(p){var o;
o=$(p.currentTarget).data("slug");
return this.track({c2:"calendar",c3:""+o+"_click"})
};
m.prototype.availabilityClick=function(){return this.track({c2:"calendar",c3:"choose_again_click",c4:this.model.get("availability").type})
};
m.prototype.startFocus=function(){return this.track({c2:"calendar",c3:"start_date_focus"})
};
m.prototype.startChange=function(){return this.track({c2:"calendar",c3:"start_date_change"})
};
m.prototype.endFocus=function(){return this.track({c2:"calendar",c3:"end_date_focus"})
};
m.prototype.endChange=function(){return this.track({c2:"calendar",c3:"end_date_change"})
};
m.prototype.oneTimeSave=function(){return this.track({c2:"calendar",c3:"onetime_save"})
};
m.prototype.nightlyFocus=function(){return this.track({c2:"price",c3:"nightly_price",c4:"per_night_focus"})
};
m.prototype.nightlyChange=function(p){var o;
o=$(p.currentTarget);
return this.track({c2:"price",c3:"nightly_price",c4:"per_night_change",c5:g(o),c6:k(o),c7:j(o)})
};
m.prototype.currencyFocus=function(p){var o;
o=$(p.currentTarget);
if(!o.parent().hasClass("open")){return this.track({c2:"price",c3:"nightly_price",c4:"currency_focus"})
}};
m.prototype.currencyChange=function(p){var o;
o=$(p.currentTarget).parent();
return this.track({c2:"price",c3:"nightly_price",c4:"currency_change",c5:o.data("currency")})
};
m.prototype.clickMonthlyWeekly=function(o){return this.track({c2:"price",c3:"set_weekly_monthly_click"})
};
m.prototype.checkboxGroupChange=function(r){var p,o,q;
p=$(r.currentTarget);
o=(q=p.attr("id"))!=null?q.replace("_checkbox",""):void 0;
return this.track({c2:"price",c3:p.data("extras")?"additional_charges":o,c4:p.is(":checked")?""+o+"_check":""+o+"_uncheck"})
};
m.prototype.checkboxGroupInputFocus=function(q){var o,p;
o=$(q.currentTarget);
p=o.attr("name");
return this.track({c2:"price",c3:o.data("extras")?"additional_charges":p,c4:""+p+"_focus"})
};
m.prototype.checkboxGroupInputChange=function(q){var o,p;
o=$(q.currentTarget);
p=o.attr("name");
if(o.val()!==""){return this.track({c2:"price",c3:o.data("extras")?"additional_charges":p,c4:""+p+"_change",c5:g(o),c6:k(o),c7:j(o)})
}};
m.prototype.focusDescriptionField=function(q){var p,o;
p=$(q.currentTarget);
o=p.attr("name");
return this.track({c2:"overview",c3:o,c4:""+o+"_focus"})
};
m.prototype.changeDescriptionField=function(q){var p,o;
p=$(q.currentTarget);
o=p.attr("name");
return this.track({c2:"overview",c3:o,c4:""+o+"_change",c5:p.val().length})
};
m.prototype.limitDescriptionField=function(q){var p,o;
p=$(q.currentTarget);
o=p.attr("name");
return this.track({c2:"overview",c3:o,c4:""+o+"_hit_limit",c5:p.val().length})
};
m.prototype.focusAddressField=function(q){var p,o;
p=$(q.currentTarget);
o=p.attr("name");
return this.track({c2:"address_v3",c3:""+o+"_focus",c4:p.val()})
};
m.prototype.changeAddressField=function(q,r){var p,o;
if(r==null){r=false
}p=$(q.currentTarget);
o=p.attr("name");
return this.track({c2:"address_v3",c3:""+o+"_change",c5:r||p.val()})
};
m.prototype.focusLicense=function(q){var p,o;
p=$(q.currentTarget);
o=p.attr("name");
return this.track({c2:"details",c3:"license",c4:""+o+"_focus"})
};
m.prototype.changeLicense=function(q){var p,o;
p=$(q.currentTarget);
o=p.attr("name");
return this.track({c2:"details",c3:"license",c4:""+o+"_change",c5:p.val().length})
};
m.prototype.focusSelectField=function(q){var p,o;
p=$(q.currentTarget);
o=p.attr("name");
return this.track({c2:"address_v3",c3:""+o+"_focus",c4:p.val()})
};
m.prototype.changeSelectField=function(p){var o;
o=$(p.currentTarget).val();
return this.changeAddressField(p,o)
};
m.prototype.editRooms=function(){return this.track({c2:"listing",c3:"rooms_and_bed",c4:"edit_click"})
};
m.prototype.toggleAmenities=function(p){var o;
o=$(p.currentTarget);
return this.track({c2:"amenities",c3:"amenities",c4:o.is(":checked")?"amenity_check":"amenity_uncheck",c5:o.parent().text().trim(),c6:o.attr("id")})
};
m.prototype.detailsForConfirmedGuestsFields=function(q){var p,o;
p=$(q.currentTarget);
o=p.attr("name");
this.track({c2:"details",c3:"details_for_confirmed_guests",c4:""+o+"_focus"});
return p.one("change",(function(r){return function(){return r.track({c2:"details",c3:"details_for_confirmed_guests",c4:""+o+"_change",c5:p.val().length})
}
})(this))
};
m.prototype.addPhotoClick=function(){var o;
o=!this.model.get("photos").length;
return this.track({c2:"photos",c3:o?"first_screen":"photo_tabs_screen",c4:"add_photos_click"})
};
m.prototype.photoUpload=function(q,p){var o;
o=!this.model.get("photos").length;
return this.track({c2:"photos",c3:o?"first_screen":"photo_tabs_screen",c4:"add_photos_upload",c5:p.files.length})
};
m.prototype.guestsFocus=function(o){return this.track({c2:"price",c3:"additional_charges",c4:"number_guests_focus"})
};
m.prototype.guestsChange=function(p){var o;
o=$(p.currentTarget);
return this.track({c2:"price",c3:"additional_charges",c4:"number_guests_change",c5:this.model.get("listing_price_for_extra_person_native"),c6:parseInt(o.val(),10)})
};
m.prototype.clickAddDetails=function(){return this.track({c2:"overview",c3:"detailed_description_click",c4:this.model.get("name")?this.model.get("name").length:void 0,c5:this.model.get("summary")?this.model.get("summary").length:void 0})
};
m.prototype.editPhotoCaption=function(r){var q,s,p,o,u;
q=$(r.currentTarget);
o=q.closest(".photo-item");
s=o.find(".first-photo-ribbon").is(":visible");
p=s?"key":"other";
u=q.val();
this.track({c2:"photos",c3:"photo_tabs_screen",c3:""+p+"_photo_caption_focus"});
return q.one("blur",(function(v){return function(){var w;
w=q.val();
if(u!==w){return v.track({c2:"photos",c3:"photo_tabs_screen",c3:""+p+"_photo_caption_change",c4:w.length})
}}
})(this))
};
m.prototype.photoPreviewClick=function(){return this.track({c2:"photos",c3:"photo_preview_click"})
};
m.prototype.photoDrag=function(r){var q,s,p,o;
q=$(r.currentTarget);
o=q.closest(".photo-item");
s=o.find(".first-photo-ribbon").is(":visible");
p=s?"key":"other";
return this.track({c2:"photos",c3:"photo_tabs_screen",c4:""+p+"_photo_drag"})
};
m.prototype.deletePhotoModal=function(o){return this.track({c2:"photos",c3:"photo_tabs_screen",c4:"photo_delete_click"})
};
m.prototype.deletePhotoConfirm=function(o){return this.track({c2:"photos",c3:"photo_tabs_screen",c4:"photo_delete_confirm"})
};
m.prototype.fbConnect=function(){return this.track({c2:"complete_profile",c3:"photo_upload",c4:"fb_connect_click"})
};
m.prototype.selectGuestExperience=function(o){return this.track({c2:o.section,c3:o.clickType,c5:"experience_classification",c6:"new_ml"})
};
m.prototype.viewGuestExperience=function(o){return this.track({c2:o.section,c3:"view_experience",c5:"experience_classification",c6:"new_ml"})
};
m.prototype.uploadProfilePic=function(){return this.track({c2:"complete_profile",c3:"photo_upload",c4:"upload_photo_click"})
};
m.prototype.profilePhotoSuccess=function(o){return this.track({c2:"complete_profile",c3:"photo_upload",c4:"success",c5:o})
};
m.prototype.addPhoneClick=function(){return this.track({c2:"complete_profile",c3:"add_phone",c4:"add_phone_click"})
};
m.prototype.verifyPhoneClick=function(){return this.track({c2:"complete_profile",c3:"add_phone",c4:"verify_phone_click"})
};
m.prototype.completeListIt=function(){return this.track({c2:"complete_profile",c3:"click_to_publish",c4:"list_it_click"})
};
m.prototype.phoneNumberWidget=function(){var o,p;
p={c2:"complete_profile",c3:"verify_phone_widget"};
o=$("body");
o.on("phone_modal_event",(function(q){return function(s,r){return q.track(_.extend({c4:r},p))
}
})(this));
o.on("focus","#phone_number",(function(q){return function(){return q.track(_.extend({c4:"phone_number_focus"},p))
}
})(this));
o.on("change","#phone_number",(function(q){return function(s){var r;
r=$(s.currentTarget).val().length;
return q.track(_.extend({c4:"phone_number_change",c5:r},p))
}
})(this));
o.on("focus","#phone_country",(function(q){return function(){return q.track(_.extend({c4:"country_focus"},p))
}
})(this));
o.on("change","#phone_country",(function(q){return function(r){var s;
s=$(r.currentTarget).val();
return q.track(_.extend({c4:"country_change",c5:s},p))
}
})(this));
o.on("click","#phone-verification-modal a[rel=sms]",(function(q){return function(r){q.verification_method="sms";
return q.track(_.extend({c4:"sms_verify_click"},p))
}
})(this));
o.on("click","#phone-verification-modal a[rel=call]",(function(q){return function(r){q.verification_method="call";
return q.track(_.extend({c4:"call_verify_click"},p))
}
})(this));
o.on("click","#phone-verification-modal a.why-verify",(function(q){return function(r){return q.track(_.extend({c4:"why_verify_click",c6:q.verification_method},p))
}
})(this));
o.on("click","#phone-verification-modal a.cancel",(function(q){return function(r){return q.track(_.extend({c4:"cancel_click",c6:q.verification_method},p))
}
})(this));
o.on("focus","#phone_number_verification",(function(q){return function(r){return q.track(_.extend({c4:"verify_code_focus",c6:q.verification_method},p))
}
})(this));
o.on("change","#phone_number_verification",(function(q){return function(s){var r;
r=$(s.currentTarget).val().length;
return q.track(_.extend({c4:"verify_code_change",c5:r,c6:q.verification_method},p))
}
})(this));
o.on("click","#phone-verification-modal a[rel=verify]",(function(q){return function(r){return q.track(_.extend({c4:"verify_click",c6:q.verification_method},p))
}
})(this));
o.on("click","#phone-verification-modal .close",(function(q){return function(r){return q.track(_.extend({c4:"close_click",c6:q.verification_method},p))
}
})(this));
o.on("failure","#phone-verification-modal",(function(q){return function(){return q.track(_.extend({c4:"verify_result",c5:"error",c6:q.verification_method},p))
}
})(this));
return o.on("complete","#phone-verification-modal",(function(q){return function(){return q.track(_.extend({c4:"verify_result",c5:"success",c6:q.verification_method},p))
}
})(this))
};
m.prototype.footerClick=function(){return Airbnb.Tracking.setUiRef("footer_new_ml_"+this.app.router.currentRoute)
};
m.prototype.detailsLearnMore=function(){return this.track({c2:"details",c3:"learn_more_click"})
};
m.prototype.trackGingerSnap=function(o,p){return this.track({c2:"gingersnap_note",c3:o,c4:p})
};
m.prototype.taxIdScannerMatch=function(){return this.track({c2:"tax_id_scanner",c3:"match"})
};
m.prototype.clickEditCustomPrices=function(p){var o;
o=$(p.currentTarget).data("type");
return this.track({c2:"price",c3:""+o+"_price_custom",c4:""+o+"_price_custom_edit"})
};
m.prototype.clickSetCustomPrices=function(p){var o;
o=$(p.currentTarget).data("type");
return this.track({c2:"price",c3:""+o+"_price_custom",c4:""+o+"_price_custom_set"})
};
m.prototype.clickApplyCustomPrices=function(r){var p,q,o;
q=$("#js-custom-pricing-form").serializeObject();
o=q.priceType;
_.each(q,function(u,s){if(!u||s==="priceType"){return delete q[s]
}});
p=_.keys(q).length;
return this.track({c2:"price",c3:""+o+"_price_custom",c4:""+o+"_price_custom_apply",c5:p})
};
m.prototype.trackGuidebookImpressions=function(o){var p;
p=o.numEntries;
return this.track({c2:"impressions",c3:"post_list_guidebook",c4:p})
};
m.prototype.trackNewGuidebookEntry=function(q){var p,o;
p=q!=null?q.action:void 0;
o=q!=null?q.category:void 0;
return this.track({c2:"guidebook",c3:p,c4:o})
};
m.prototype.trackCalendarSyncClicks=function(o){return this.track({c2:"calendar",c3:"calendar_sync",c4:o})
};
m.prototype.trackInstantBookFTUE=function(q,o,p){return this.track({c2:o,c3:q,c4:p})
};
m.prototype.trackInstantBookEnabledFTUE=function(o){return this.track({c2:"instant_book_enabled_ftue",c3:o})
};
return m
})(f);
g=function(m){return parseInt(m.val(),10)
};
k=function(m){var o,n;
o=m.data("suggested");
if(o){return parseInt((n=o.match(/\d+/))!=null?n[0]:void 0,10)
}else{return void 0
}};
j=function(m){var o,n;
n=k(m);
o=g(m);
if(n&&o){return n-o
}}
},{"../../views/base_view.coffee":95}],26:[function(c,d,a){var j,h,b={}.hasOwnProperty,g=function(n,l){for(var k in l){if(b.call(l,k)){n[k]=l[k]
}}function m(){this.constructor=n
}m.prototype=l.prototype;
n.prototype=new m();
n.__super__=l.prototype;
return n
},f=[].indexOf||function(n){for(var m=0,k=this.length;
m<k;
m++){if(m in this&&this[m]===n){return m
}}return -1
};
h=c("./address_helper_view.coffee");
d.exports=j=(function(k){g(l,k);
function l(){return l.__super__.constructor.apply(this,arguments)
}l.prototype.initialize=function(){this.app=this.options.app;
this.model=this.options.model;
return l.__super__.initialize.apply(this,arguments)
};
l.prototype.template="manage_listing/address/address_fields";
l.prototype.events={"blur input":"updateNavButtonState","keyup input":"updateNavButtonState","focus input":"showTooltipSticky","click .js-next-btn":"nextBtnClick","focus #zipcode":"showPossibleError","focus #city":"showPossibleError","focus #state":"showPossibleError","focus #apt":"hideError","focus #street":"hideError","change #country":"localizeAddressForm"};
l.prototype.labelPhraseKeys={apt:"ml.apt_label",street:"ml.street_label",city:"ml.city_label",state:"ml.state_label",zipcode:"ml.zipcode_label",general:{apt:"ml.apt_label_general",street:"ml.street_label_general",city:"ml.city_label_general",state:"ml.state_label_general",zipcode:"ml.zipcode_label_general"}};
l.prototype.postRender=function(){l.__super__.postRender.apply(this,arguments);
this.$el.data("pane","enter_address").addClass("enter_address");
this.trackPaneImpressions();
this.createCountrySelect();
this.localizeAddressForm();
this.initTooltip(I18n.t("ml.details.enter_address.tooltip_text"));
return _.defer((function(m){return function(){if(m.isPostPublish()){return m.changeElementsPostPublish()
}}
})(this))
};
l.prototype.bindings=function(){l.__super__.bindings.apply(this,arguments);
return this.listenTo(this.model,"saving:success:street",this.handleServerResponse)
};
l.prototype.isPostPublish=function(){return this.model.get("has_ever_been_available")
};
l.prototype.handleServerResponse=function(){var p,o,n,q,m;
m=amplify.store("tempAddress");
if(this.model.get("is_location_exact")){n=_.keys(m);
q=_.pick(this.model.attributes,n);
o=this.compareAddresses(m,q);
if(o){amplify.store("tempAddress",null);
return this.app.trigger("address:verify_address")
}else{p={userAddress:m,serverResponse:q};
return this.app.trigger("address:suggest_address",p)
}}else{return this.app.trigger("address:no_match",m)
}};
l.prototype.nextBtnClick=function(m){if(m){m.preventDefault()
}if(!$(m.currentTarget).hasClass("disabled")){this.$("[name=country_code]").attr("disabled",false);
$("#js-address-container").find(".panel").first().addClass("loading");
return this.submitForm(this.$("form"))
}};
l.prototype.submitForm=function(m){this.userInput=m.serializeObject();
amplify.store("tempAddress",this.userInput);
_.extend(this.model._changedSinceSave,this.userInput);
this.model.set({user_defined_location:false});
return this.model.save(this.userInput)
};
l.prototype.compareAddresses=function(n,q){var p,o,m;
m=this.clean(n,"");
o=this.clean(q,null);
p=_.isEqual(m,o)&&(n.street===q.street||n.street===this.model.get("street_address_short"));
return p
};
l.prototype.clean=function(p,u){var q,n,m,s,o,r;
m=_.omit(p,"apt","street");
n=[];
r=_.keys(m);
for(s=0,o=r.length;
s<o;
s++){q=r[s];
if(m[q]===u){n.push(q)
}}return _.omit(m,n)
};
l.prototype.initAutoComplete=function(){var p,o,r,m,n,q;
q=this.$("#country").find(":selected").val();
if(f.call(_.keys(this.app.get("address_data")),q)>=0){p=this.app.get("address_data")[q].disable_autocomplete
}if(!p&&!this.isPostPublish()){o=this.$("#street");
r=this.model.get("lat");
m=this.model.get("lng");
n=new google.maps.LatLng(r,m);
$(".pac-container").remove();
_.defer(function(){return o.geocomplete({map:".map-canvas",mapOptions:{center:n,zoom:11}})
});
o.on("geocode:result",(function(s){return function(w,v){var u;
s.app.trigger("address:autocomplete_used");
s.formatted_address=v.formatted_address;
u=s.parseComponents(v.address_components);
if(u.country!==s.$("#country")[0].value){s.$("#country").trigger("change",u.country)
}s.setFieldValues(u);
return o.blur()
}
})(this));
return o.on("geocode:error",(function(s){return function(v,u){return Airbnb.Utils.log("geocode:error, e, data",v,u)
}
})(this))
}};
l.prototype.setFieldValues=function(n){var m;
m={};
m.street=this.assembleStreetAddress(n.street_number,n.route);
m.zipcode=n.postal_code;
if(n.locality){m.city=n.locality
}else{if(n.postal_town){m.city=n.postal_town
}}if(n.administrative_area_level_1){m.state=n.administrative_area_level_1
}else{if(n.administrative_area_level_2){m.state=n.administrative_area_level_2
}}if(n.country_code){m.country_code=n.country_code
}else{if(n.country){m.country_code=n.country
}}return _.defer((function(o){return function(){return o.fillInFields(m)
}
})(this))
};
l.prototype.assembleStreetAddress=function(p,m){var o,s,r,n,v,u,q;
q=new RegExp(p);
u=this.formatted_address.split(",");
if(u.length>0){o=u[0];
if((o.search(q))!==-1){return o
}else{n=u[1];
r=n.search(q);
s=r+p.length;
v=n.substring(0,s);
return o+","+v
}}else{return p+" "+m
}};
l.prototype.fillInFields=function(m){this.$("[name=street]").val(m.street);
this.$("[name=apt]").val(m.apt);
this.$("[name=zipcode]").val(m.zipcode);
this.$("[name=city]").val(m.city);
this.$("[name=state]").val(m.state);
this.$("#country-select").find("[value='"+m.country_code+"']").attr("selected","selected");
return this.updateNavButtonState()
};
l.prototype.parseComponents=function(p){var n,m,o;
m={};
n=["administrative_area_level_1","administrative_area_level_2","locality","route"];
o=null;
_.each(p,function(q){return _.each(q.types,function(r){if(_.contains(n,r)){m[r]=q.long_name
}else{m[r]=q.short_name
}if(r==="administrative_area_level_1"){return o=q.short_name
}})
});
if(m.country==="US"&&o){m.administrative_area_level_1=o
}return m
};
l.prototype.createCountrySelect=function(){return _.defer((function(m){return function(){var o,n;
o=$("#country-select");
n=m.model.get("country_code");
o.html(JST["manage_listing/country_select"]({countries:m.app.get("countries")}));
return o.find("[value='"+n+"']").attr("selected","selected")
}
})(this))
};
l.prototype.updateNavButtonState=function(){var m;
m=this.isFormComplete();
return this.app.trigger("address_nav:update_btn",m)
};
l.prototype.isFormComplete=function(){var m,n;
n=this.$("#country").find(":selected").val();
if(f.call(_.keys(this.app.get("address_data")),n)>=0){m=this.app.get("address_data")[n].requiredFields
}else{m=["country_code","city","street"]
}return _.all(m,function(o){return this.$("[name='"+o+"']").val()
})
};
l.prototype.localizeAddressForm=function(p){var m,o,r,n,q;
if(p){q=this.$("#country").val()
}else{q=this.model.get("country_code")
}if(f.call(_.keys(this.app.get("address_data")),q)>=0){r=this.app.get("address_data")[q];
m=r.fields;
n=r.placeholders;
m=_.map(m,(function(s){return function(u){return{name:u,labelPhraseKey:s.labelPhraseKeys[u],placeholder:n[u],value:s.model.get(u)}
}
})(this))
}else{r=this.app.get("address_data")["DEFAULT"];
m=r.fields;
n=r.placeholders;
m=_.map(m,(function(s){return function(u){return{name:u,labelPhraseKey:s.labelPhraseKeys.general[u],placeholder:n[u]!=null?n[u]:void 0,value:s.model.get(u)}
}
})(this))
}o=JST["manage_listing/address/address_fields/field_template"]({fields:m});
this.$("#localized-fields").html(o);
return _.defer((function(s){return function(){Airbnb.Utils.loadGooglePlaces();
Airbnb.Utils.withGooglePlaces(function(){return s.initAutoComplete()
});
return s.updateNavButtonState()
}
})(this))
};
l.prototype.changeElementsPostPublish=function(){this.$("[name=zipcode]").attr("readOnly",true);
this.$("[name=city]").attr("readOnly",true);
this.$("[name=state]").attr("readOnly",true);
return this.$("[name=country_code]").attr("disabled",true)
};
l.prototype.showPossibleError=function(){if(this.isPostPublish()){return this.$("#error-clicked-frozen-field").removeClass("hide")
}};
l.prototype.hideError=function(){return this.$("#error-clicked-frozen-field").addClass("hide")
};
return l
})(h)
},{"./address_helper_view.coffee":27}],27:[function(c,f,a){var j,d,h,b={}.hasOwnProperty,g=function(n,l){for(var k in l){if(b.call(l,k)){n[k]=l[k]
}}function m(){this.constructor=n
}m.prototype=l.prototype;
n.prototype=new m();
n.__super__=l.prototype;
return n
};
h=c("o2");
d=c("./base_view.coffee");
f.exports=j=(function(l){g(k,l);
function k(){return k.__super__.constructor.apply(this,arguments)
}k.prototype.bindings=function(){k.__super__.bindings.apply(this,arguments);
this.listenTo(this.app,"address_nav:update_btn",this.updateAddressNavButton);
return this.listenTo(this.app,"disaster:not_in_disaster_zone",this.showDisasterZoneNotice)
};
k.prototype.showDisasterZoneNotice=function(){return this.$("#js-disaster-address-alert").removeClass("hide")
};
k.prototype.getCountryFullName=function(m){var n;
n=_.findWhere(this.app.get("countries"),{code:m});
return n.name
};
k.prototype.getStaticMapUrl=function(n){var o,m;
if(n==null){n={}
}o={zoom:"15",maptype:"roadmap",sensor:"false",center:""+(this.model.get("lat"))+", "+(this.model.get("lng")),size:"320x320"};
n=_.defaults(n,o);
return m=["//maps.googleapis.com/maps/api/staticmap?","center="+n.center+"&zoom="+n.zoom+"&size="+n.size,"&maptype="+n.maptype+"&sensor="+n.sensor+"&style="+n.style,"&key=AIzaSyA8dBXcpx7L0t_36KxQwxwxSX6F5ASthMQ"].join("")
};
k.prototype.updateAddressNavButton=function(n){var m;
m=$(".js-next-btn");
if(n){m.removeClass("disabled");
return $(".js-address-nav-btn-tooltip").css("visibility","hidden")
}else{m.addClass("disabled");
return $(".js-address-nav-btn-tooltip").css("visibility","visible")
}};
k.prototype.trackPaneImpressions=function(){return this.app.trigger("address:pane_impression")
};
k.prototype.getSavedAddress=function(){var m;
return m={street:this.model.get("street"),apt:this.model.get("apt"),city:this.model.get("city"),state:this.model.get("state"),zipcode:this.model.get("zipcode"),country:this.model.get("country"),country_code:this.model.get("country_code")}
};
k.prototype.cleanup=function(){var m;
k.__super__.cleanup.apply(this,arguments);
return(m=this.addressNavTooltip)!=null?m.dispose():void 0
};
k.prototype.initTooltip=function(o){var m,n;
if((n=this.addressNavTooltip)!=null){n.dispose()
}m=JST["manage_listing/address/address_nav_tooltip"]({text:o});
return this.addressNavTooltip=new h.Tooltip(m,".js-next-btn")
};
return k
})(d)
},{"./base_view.coffee":34,o2:"o2"}],28:[function(d,f,b){var h,a,c={}.hasOwnProperty,g=function(m,k){for(var j in k){if(c.call(k,j)){m[j]=k[j]
}}function l(){this.constructor=m
}l.prototype=k.prototype;
m.prototype=new l();
m.__super__=k.prototype;
return m
};
h=d("./address_helper_view.coffee");
f.exports=a=(function(k){g(j,k);
function j(){return j.__super__.constructor.apply(this,arguments)
}j.prototype.template="manage_listing/address/address_not_found";
j.prototype.events={"click .js-next-btn":"handleAddressNavClick"};
j.prototype.initialize=function(){this.app=this.options.app;
this.model=this.options.model;
this.fields=this.options.address;
return j.__super__.initialize.apply(this,arguments)
};
j.prototype.getRenderData=function(){var l,m;
j.__super__.getRenderData.apply(this,arguments);
l=JST["manage_listing/address/secondary_choice_button"]({"class":"js-edit-address-btn",btnText:I18n.t("rooms.edit.edit_address")});
if(!this.fields.country){this.fields.country=this.getCountryFullName(this.fields.country_code)
}m={address:this.fields,addressPresenter:this.options.addressPresenter,altChoiceBtnHtml:l};
return _.extend(this.model.data(),m)
};
j.prototype.postRender=function(){this.$el.data("pane","location_not_found").addClass("location_not_found");
this.trackPaneImpressions();
return j.__super__.postRender.apply(this,arguments)
};
j.prototype.handleAddressNavClick=function(l){if(l){l.preventDefault()
}this.$el.addClass("loading");
_.extend(this.model._changedSinceSave,this.fields);
this.model.save(this.fields);
return this.app.trigger("address:pin_on_map",{pane:"pin_location",draggable:true,address:this.fields})
};
return j
})(h)
},{"./address_helper_view.coffee":27}],29:[function(c,d,a){var g,h,b={}.hasOwnProperty,f=function(m,k){for(var j in k){if(b.call(k,j)){m[j]=k[j]
}}function l(){this.constructor=m
}l.prototype=k.prototype;
m.prototype=new l();
m.__super__=k.prototype;
return m
};
g=c("./address_helper_view.coffee");
d.exports=h=(function(j){f(k,j);
function k(){return k.__super__.constructor.apply(this,arguments)
}k.prototype.template="manage_listing/address/address_suggestion";
k.prototype.events={"click input[name=address-choice]":"clickAddressChoice","click .js-next-btn":"clickNextBtn"};
k.prototype.initialize=function(){this.app=this.options.app;
this.addresses=this.options.addresses;
return k.__super__.initialize.apply(this,arguments)
};
k.prototype.getRenderData=function(){var l;
if(!this.addresses.serverResponse.country){this.addresses.serverResponse.country=this.getCountryFullName(this.addresses.serverResponse.country_code)
}if(!this.addresses.userAddress.country){this.addresses.userAddress.country=this.getCountryFullName(this.addresses.userAddress.country_code)
}l={suggestedAddress:this.addresses.serverResponse,originalAddress:this.addresses.userAddress,addressPresenter:this.app.get("address_data")};
return l
};
k.prototype.postRender=function(){this.$el.data("pane","suggested_address").addClass("suggested_address");
this.trackPaneImpressions();
this.initTooltip(I18n.t("ml.details.suggested_address.tooltip_text"));
return k.__super__.postRender.apply(this,arguments)
};
k.prototype.clickAddressChoice=function(l){this.$("[data-selected]").removeClass("selected-choice").removeClass("unselected-choice-on").addClass("unselected-choice");
$(l.currentTarget).closest("[data-selected]").toggleClass("unselected-choice selected-choice");
return this.app.trigger("address_nav:update_btn",true)
};
k.prototype.clickNextBtn=function(n){var m,l,o;
if(n){n.preventDefault()
}if(!$(n.currentTarget).hasClass("disabled")){m=this.$("input[name=address-choice]:checked").val();
if(m==="original-address"){l=this.addresses.userAddress;
l.user_defined_location=true;
_.extend(this.model._changedSinceSave,l);
this.model.save(l);
o="pin_location"
}else{o="verify_location"
}return this.app.trigger("address:verify_address",{pane:o})
}};
return k
})(g)
},{"./address_helper_view.coffee":27}],30:[function(f,c,j){var h,n,k,a,b,l,d,m={}.hasOwnProperty,g=function(r,p){for(var o in p){if(m.call(p,o)){r[o]=p[o]
}}function q(){this.constructor=r
}q.prototype=p.prototype;
r.prototype=new q();
r.__super__=p.prototype;
return r
};
d=f("o2");
n=f("./address_helper_view.coffee");
h=f("./address_fields_view.coffee");
a=f("./address_suggestion_view.coffee");
k=f("./address_not_found_view.coffee");
l=f("./map_pin_view.coffee");
c.exports=b=(function(p){g(o,p);
function o(){return o.__super__.constructor.apply(this,arguments)
}o.prototype.initialize=function(){this.app=this.options.app;
this.subviews=[];
return o.__super__.initialize.apply(this,arguments)
};
o.prototype.events={"click .js-edit-address-link":"handleEditAddressClick","click .js-edit-address-btn":"handleEditAddressClick"};
o.prototype.template="manage_listing/address/address_view";
o.prototype.bindings=function(){o.__super__.bindings.apply(this,arguments);
this.listenTo(this.app,"address:verify_address",this.renderMapPinView);
this.listenTo(this.app,"address:pin_on_map",this.renderMapPinView);
this.listenTo(this.app,"address:suggest_address",this.renderAddressSuggestion);
this.listenTo(this.app,"address:edit_address",this.renderAddressFieldsView);
return this.listenTo(this.app,"address:no_match",this.renderAddressNotFound)
};
o.prototype.postRender=function(){o.__super__.postRender.apply(this,arguments);
this.renderAddressFieldsView();
return this.launchModal()
};
o.prototype.launchModal=function(){this.addressFlowModal=new d.Modal(this.$el.find(".modal"),{sticky:true});
this.addressFlowModal.open();
return this.addressFlowModal.on("close",(function(q){return function(){q.subviewCleanup();
return q.app.router.showNYLegalIfNeeded()
}
})(this))
};
o.prototype.handleEditAddressClick=function(s){var q,r;
if(s){s.preventDefault()
}q=$(s.currentTarget);
r=!!q.parent("#js-original-address").length||!!q.parent(".address-not-found").length;
s.data={unsavedUserInput:r};
return this.app.trigger("address:edit_address",s)
};
o.prototype.cleanup=function(){if(this.addressFlowModal){this.addressFlowModal.close();
this.addressFlowModal=null
}this.subviewCleanup();
return o.__super__.cleanup.apply(this,arguments)
};
o.prototype.subviewCleanup=function(){var u,s,q,r;
r=this.subviews;
for(s=0,q=r.length;
s<q;
s++){u=r[s];
u.cleanup()
}this.subviews=[];
if(this.$("#js-address-container").length===0){return this.$(".modal-content").prepend('<div id="js-address-container"></div>')
}};
o.prototype.renderAddressSuggestion=function(q){this.subviewCleanup();
this.addressSuggestionView=new a({el:this.$("#js-address-container"),model:this.model,app:this.app,addresses:q});
this.addressSuggestionView.render();
return this.subviews.push(this.addressSuggestionView)
};
o.prototype.renderAddressNotFound=function(q){q.country_code=this.model.get("country_code");
this.subviewCleanup();
this.addressNotFoundView=new k({el:this.$("#js-address-container"),model:this.model,app:this.app,address:q,addressPresenter:this.app.get("address_data")});
this.addressNotFoundView.render();
return this.subviews.push(this.addressNotFoundView)
};
o.prototype.renderMapPinView=function(q){if(q==null){q={}
}this.subviewCleanup();
this.mapView=new l(_.extend(q,{el:this.$("#js-address-container"),model:this.model,app:this.app}));
this.mapView.render();
return this.subviews.push(this.mapView)
};
o.prototype.renderAddressFieldsView=function(q){this.subviewCleanup();
this.addressFieldsView=new h({el:this.$("#js-address-container"),model:this.model,app:this.app}).render();
return this.subviews.push(this.addressFieldsView)
};
return o
})(n)
},{"./address_fields_view.coffee":26,"./address_helper_view.coffee":27,"./address_not_found_view.coffee":28,"./address_suggestion_view.coffee":29,"./map_pin_view.coffee":73,o2:"o2"}],31:[function(f,c,h){var j,a,b,d,k={}.hasOwnProperty,g=function(o,m){for(var l in m){if(k.call(m,l)){o[l]=m[l]
}}function n(){this.constructor=o
}n.prototype=m.prototype;
o.prototype=new n();
o.__super__=m.prototype;
return o
};
j=f("../models/advanced_pricing.coffee");
d=f("o2");
b=f("./page_view.coffee");
c.exports=a=(function(m){g(l,m);
function l(){return l.__super__.constructor.apply(this,arguments)
}l.prototype.template="manage_listing/pricing/advanced_pricing_modal";
l.prototype.events={"click .js-save-advanced-prices":"savePrices"};
l.prototype.initialize=function(){var n;
l.__super__.initialize.apply(this,arguments);
moment.lang(I18n.locale());
this.app=this.options.app;
this.numberOfWeeks=56;
this.numberOfMonths=13;
n={app:this.app,listing:this.options.model};
this.weeklyModel=new j({},_.extend(n,{type:"weekly"}));
this.weeklyModel.fetch();
this.monthlyModel=new j({},_.extend(n,{type:"monthly"}));
this.monthlyModel.fetch();
this.listenTo(this.weeklyModel,"sync",this.signalChange);
this.listenTo(this.weeklyModel,"saving:success",this.closeModal);
this.listenTo(this.weeklyModel,"saving:no_changes",this.closeModal);
this.listenTo(this.monthlyModel,"sync",this.signalChange);
this.listenTo(this.monthlyModel,"saving:success",this.closeModal);
return this.listenTo(this.monthlyModel,"saving:no_changes",this.closeModal)
};
l.prototype.signalChange=function(){return this.trigger("advanced_pricing:changed")
};
l.prototype.getCount=function(n){if(n==="monthly"){return this.monthlyModel.count()
}else{return this.weeklyModel.count()
}};
l.prototype.renderCustomPricingView=function(n){this.priceType=n;
return this.render()
};
l.prototype.getRenderData=function(){var q,r,n,o,p;
if(this.priceType==="monthly"){r=I18n.t("ml.pricing.monthly.custom_montly_prices");
p=I18n.t("ml.pricing.monthly.set_monthly_price_info");
n=I18n.t("ml.section.pricing.Per month");
q=this.getMonthlyData(this.monthlyModel.data())
}else{r=I18n.t("ml.pricing.weekly.custom_weekly_prices");
p=I18n.t("ml.pricing.weekly.set_weekly_price_info");
n=I18n.t("ml.section.pricing.Per week");
q=this.getWeeklyData(this.weeklyModel.data())
}return o={header:r,subHeader:p,type:this.priceType,perTypeLabel:n,currencySymbol:this.options.model.currencySymbol(),dates:q}
};
l.prototype.postRender=function(){return this.launchModal()
};
l.prototype.launchModal=function(){this.pricingModal=new d.Modal(this.$el.find(".modal"),{sticky:true});
return this.pricingModal.open()
};
l.prototype.getNextWeekDay=function(n,p){var o;
if(!p){p=new Date();
p.setDate(p.getDate()-8)
}o=new Date(p.getTime());
o.setDate(p.getDate()-p.getDay()+7+n);
return o
};
l.prototype.getWeeklyLabel=function(p,o){var n;
p=moment(p).format("L");
o=moment(o).format("L");
return n=""+p+" - "+o
};
l.prototype.getMonthlyLabel=function(q){var o,n,p;
n=$.datepicker._defaults.monthNames[q.getMonth()];
p=q.getFullYear();
return o=""+n+" "+p
};
l.prototype.formatDate=function(q){var o,n,p;
p=q.getMonth()+1;
if(p<10){p="0"+p
}n=q.getDate();
if(n<10){n="0"+n
}return o=""+(q.getFullYear())+"-"+p+"-"+n
};
l.prototype.getNameFromFormattedDate=function(o){var n;
return n="d_"+(o.replace(/-/g,"_"))
};
l.prototype.getFormattedDateFromName=function(o){var n;
n=o.match(/^d_(.*)$/);
if(n){return n[1].replace(/_/g,"-")
}else{return null
}};
l.prototype.getMondays=function(){var p,o,n,r,q;
n=[];
o=null;
for(p=r=0,q=this.numberOfWeeks-1;
0<=q?r<=q:r>=q;
p=0<=q?++r:--r){o=this.getNextWeekDay(1,o);
n.push(o)
}return n
};
l.prototype.getSundays=function(){var n,o;
n=this.getMondays();
o=[];
_.each(n,function(q){var p;
p=moment(q).add("days",6);
return o.push(p)
});
return o
};
l.prototype.getWeeklyData=function(p){var o,n,q,u,v,w,x,r,s;
if(p==null){p={}
}v=this.getMondays();
w=this.getSundays();
x=[];
for(u=r=0,s=this.numberOfWeeks-2;
0<=s?r<=s:r>=s;
u=0<=s?++r:--r){o=v[u];
n=w[u];
q={date:this.formatDate(o),label:this.getWeeklyLabel(o,n)};
q.name=this.getNameFromFormattedDate(q.date);
if(p[q.date]){q.value=p[q.date]
}x.push(q)
}return x
};
l.prototype.getMonthlyData=function(n){var v,q,p,u,o,s,r;
if(n==null){n={}
}o=new Date();
u=[];
for(p=s=0,r=this.numberOfMonths-1;
0<=r?s<=r:s>=r;
p=0<=r?++s:--s){v=new Date(o.getFullYear(),o.getMonth()+p,1);
q={date:this.formatDate(v),label:this.getMonthlyLabel(v)};
q.name=this.getNameFromFormattedDate(q.date);
if(n[q.date]){q.value=n[q.date]
}u.push(q)
}return u
};
l.prototype.retrieveNumber=function(o){var n;
if(!o){return null
}o=o.replace(/^\s\s*/,"").replace(/\s\s*$/,"");
n=parseInt(o);
if(!isNaN(n)&&isFinite(o)){return n
}else{return null
}};
l.prototype.closeModal=function(){if(this.pricingModal){return this.pricingModal.close()
}};
l.prototype.savePrices=function(n){if(n){n.preventDefault()
}if(!$(n.currentTarget).hasClass("disabled")){this.$(".modal-content").addClass("loading");
return this.submitForm(this.$("#js-custom-pricing-form"))
}};
l.prototype.submitForm=function(o){var q,p,n;
q={};
n=o.serializeObject();
p=n.priceType;
_.each(_.keys(n),(function(r){return function(s){var u,v;
if(s.match(/^d/)){u=r.getFormattedDateFromName(s);
v=r.retrieveNumber(n[s]);
return q[u]=v
}}
})(this));
if(p==="monthly"){return this.monthlyModel.save(q)
}else{return this.weeklyModel.save(q)
}};
return l
})(b)
},{"../models/advanced_pricing.coffee":8,"./page_view.coffee":79,o2:"o2"}],32:[function(d,f,a){var c,h,b={}.hasOwnProperty,g=function(m,k){for(var j in k){if(b.call(k,j)){m[j]=k[j]
}}function l(){this.constructor=m
}l.prototype=k.prototype;
m.prototype=new l();
m.__super__=k.prototype;
return m
};
h=d("./page_view.coffee");
f.exports=c=(function(k){g(j,k);
function j(){return j.__super__.constructor.apply(this,arguments)
}j.prototype.initialize=function(){this.app=this.options.app;
this.subviews=[];
this.on("render:dom_inserted",this.onDOMInserted,this);
return j.__super__.initialize.apply(this,arguments)
};
j.prototype.template="manage_listing/amenities";
j.prototype.tracking_name="amenities";
j.prototype.events={"hover [data-tooltip-element]":"showTooltipSticky","change input[name=amenities]":"saveAmenities"};
j.prototype.getRenderData=function(){return{amenitiesData:{mostCommon:{slug:"common",amenities:this.app.get("common_amenities")},extras:{slug:"extras",amenities:this.app.get("extra_amenities")},specialFeatures:{slug:"special",amenities:this.app.get("special_amenities")},homeSafety:{slug:"home_safety",amenities:this.app.get("home_safety_amenities")}},extendedSubtitleContentHomeSafety:this.getHomeSafetySubtitleContent()}
};
j.prototype.getHomeSafetySubtitleContent=function(){var m,l;
l=JST["manage_listing/home_safety_amenities_subtitle"];
m={subtitleContentWithHomeSafetyLink:"ml.section.amenities.home_safety_body_2",subtitleContentWithContactLink:"ml.section.amenities.home_safety_body_3"};
return l(m)
};
j.prototype.onDOMInserted=function(){return this.app.trigger("render:dom_inserted:amenities_view")
};
j.prototype.postRender=function(){j.__super__.postRender.apply(this,arguments);
return this.initAmenities()
};
j.prototype.saveAmenities=function(o){var q,n,u,s,p,l,m,r;
q=$(o.currentTarget);
this.toggleAmenityLabel(q.val());
this.toggleDependentAmenities(q);
p=[];
s=this.$el.find("input:checkbox[name=amenities]:checked");
l=function(){return p.push(parseInt($(u).val()))
};
for(n=m=0,r=s.length;
m<r;
n=++m){u=s[n];
l()
}return this.saveModelForEvent(o,this.model,"amenities_ids",p)
};
j.prototype.toggleDependentAmenities=function(m){var l;
l=m.closest("li").children(".dependent-amenities-list");
if(l.length===0){return
}if(m.is(":checked")){return l.removeClass("hide")
}else{l.addClass("hide");
return l.find(":checkbox").attr("checked",false)
}};
j.prototype.toggleAmenityLabel=function(m){var l;
l=this.$el.find("label[for='"+m+"']");
if(l.hasClass("checked")){return l.removeClass("checked")
}else{return l.addClass("checked")
}};
j.prototype.initAmenities=function(){return this.setCurrentAmenities()
};
j.prototype.setCurrentAmenities=function(){var q,n,o,p,m,l;
q=this.model.get("amenities_ids");
l=[];
for(n=p=0,m=q.length;
p<m;
n=++p){o=q[n];
l.push((function(r){return function(){r.$el.find("input[value='"+o+"']").prop("checked",true);
return r.toggleAmenityLabel(o)
}
})(this)())
}return l
};
return j
})(h)
},{"./page_view.coffee":79}],33:[function(d,g,a){var c,f,j,b={}.hasOwnProperty,h=function(n,l){for(var k in l){if(b.call(l,k)){n[k]=l[k]
}}function m(){this.constructor=n
}m.prototype=l.prototype;
n.prototype=new m();
n.__super__=l.prototype;
return n
};
j=d("o2");
f=d("./base_view.coffee");
g.exports=c=(function(l){h(k,l);
function k(){return k.__super__.constructor.apply(this,arguments)
}k.prototype.template="manage_listing/apple_turnover";
k.prototype.className="modal";
k.prototype.attributes={role:"dialog"};
k.prototype.postRender=function(){var m;
m=new j.Modal(this.$el);
return m.open()
};
k.prototype.getRenderData=function(){return{firstName:this.model.attributes.user.user.first_name}
};
return k
})(f)
},{"./base_view.coffee":34,o2:"o2"}],34:[function(c,a,f){var g,k,b,h=function(l,m){return function(){return l.apply(m,arguments)
}
},j={}.hasOwnProperty,d=function(o,m){for(var l in m){if(j.call(m,l)){o[l]=m[l]
}}function n(){this.constructor=o
}n.prototype=m.prototype;
o.prototype=new n();
o.__super__=m.prototype;
return o
};
b=c("o2");
this.ManageListing||(this.ManageListing={});
g=c("../../../views/base_view.coffee");
k=c("../section_save_progress_manager.coffee");
a.exports=g=(function(m){d(l,m);
function l(){this.showTooltipSticky=h(this.showTooltipSticky,this);
return l.__super__.constructor.apply(this,arguments)
}l.prototype.initialize=function(n){this.sectionSaveProgressManager=new k;
this.on("render:dom_inserted",this.domInsertedDependencies,this);
this.on("initialize",function(){if(this.app!=null){return this.app.trigger("impression",this)
}});
return l.__super__.initialize.apply(this,arguments)
};
l.prototype.domInsertedDependencies=function(){return this.initO2()
};
l.prototype.getTrackingName=function(){return this.tracking_name
};
l.prototype.getTrackingKey=function(){if(((typeof this.getTrackingPrefix==="function"?this.getTrackingPrefix():void 0)!=null)&&((typeof this.getTrackingName==="function"?this.getTrackingName():void 0)!=null)){return""+(this.getTrackingPrefix())+"_"+(this.getTrackingName())
}else{if((typeof this.getTrackingName==="function"?this.getTrackingName():void 0)!=null){return this.getTrackingName()
}}};
l.prototype.getTrackingPrefix=function(){if(!((this.model!=null)&&"has_ever_been_available" in this.model.attributes)){return null
}if(this.model.get("has_ever_been_available")){return"post_list"
}else{return"pre_list"
}};
l.prototype.getRenderData=function(){return{listing:this.model.data()}
};
l.prototype.hasRendered=function(){return this.__hasRendered===true
};
l.prototype.isBackgroundView=function(){if(this.shouldPreserveInBackground===true){if(!this.id){throw"Background Views must implement an id"
}return true
}else{return false
}};
l.prototype.isRenderedBackgroundView=function(){return this.isBackgroundView()&&this.hasRendered()
};
l.prototype.cleanup=function(){if(this.isBackgroundView()){if(this.tooltip!=null){this.tooltip.$element.addClass("no-transition");
this.tooltip.hide();
this.tooltip.$element.reflow();
this.tooltip.$element.removeClass("no-transition")
}this.tooltip=null;
return this.cleanupO2()
}else{_.each(this.subviews||[],function(n){return typeof n.cleanup==="function"?n.cleanup():void 0
});
this.off();
this.remove();
return this.cleanupO2()
}};
l.prototype.initO2=function(){if(this.modals==null){this.modals=[]
}if(this.tooltips==null){this.tooltips=[]
}if(this.tabs==null){this.tabs=[]
}this.modals=this.modals.concat(b.Modal.bind(this.$el));
this.tooltips=this.tooltips.concat(b.Tooltip.bind(this.$el));
return this.tabs=this.tabs.concat(b.Tabs.bind(this.$el))
};
l.prototype.cleanupO2=function(){_.each(this.tooltips,function(n){return n.dispose()
});
_.each(this.modals,function(n){return n.dispose()
});
this.tooltips=[];
return this.modals=[]
};
l.prototype.postRender=function(){this.placeHolderShim();
return l.__super__.postRender.apply(this,arguments)
};
l.prototype.placeHolderShim=function(){return this.$el.find("input[placeholder], textarea[placeholder]").placeholder()
};
l.prototype.showTooltipSticky=function(u){var o,n,q,s,p,r,v;
v=$(u.currentTarget).attr("id")||$(u.currentTarget).parent().attr("id");
n=this.$("#"+v);
o=$(".manage-listing-content");
s=this.$(".help-tooltip[data-trigger=#"+v+"]");
q=$(".help-tooltip");
q.hide();
p=o.outerWidth()-2;
r=n.offset().top-80;
if(r<5){r=r+20
}s.css({top:r,left:p,opacity:1});
return s.show()
};
l.prototype.handleBlur=function(r){var p,o,n,q;
p=$(r.currentTarget);
if(p.hasClass("invalid")){return
}n=p.attr("name");
q=this.fieldValue(p);
o=this.modelForField(p);
return this.saveModelForEvent(r,o,n,q)
};
l.prototype.handleBlurWithoutSave=function(o){var n;
n=$(o.currentTarget);
if(n.hasClass("invalid")){return
}return this.updateFromField(n)
};
l.prototype.updateFromField=function(p){var o,n,q;
n=p.attr("name");
q=this.fieldValue(p);
o=this.modelForField(p);
return o.set(n,q)
};
l.prototype.fieldValue=function(n){if(n.is("input[type=checkbox]")){return n.is(":checked")
}else{return n.val()
}};
l.prototype.saveModelForEvent=function(r,o,p,q){var n;
n=$(r.currentTarget).closest(".js-section");
o.set(p,q);
return this.saveModelAndTrackProgressInSection(o,n)
};
l.prototype.saveModelAndTrackProgressInSection=function(o,n){if(!n||n.length===0){Airbnb.Utils.log("sectionEl does not exist")
}if(o.hasChangedSinceSave()){this.sectionSaveProgressManager.onSaveStart(n);
return o.save({},{success:(function(p){return function(){return p.sectionSaveProgressManager.onSaveSuccess(n)
}
})(this),fail:(function(p){return function(){return p.sectionSaveProgressManager.onSaveFailure(n)
}
})(this)})
}else{return o.save()
}};
l.prototype.modelForField=function(n){return this.model
};
l.prototype.render=function(){l.__super__.render.apply(this,arguments);
this.__hasRendered=true;
return this
};
return l
})(g)
},{"../../../views/base_view.coffee":95,"../section_save_progress_manager.coffee":24,o2:"o2"}],35:[function(c,d,a){var g,h,b={}.hasOwnProperty,f=function(m,k){for(var j in k){if(b.call(k,j)){m[j]=k[j]
}}function l(){this.constructor=m
}l.prototype=k.prototype;
m.prototype=new l();
m.__super__=k.prototype;
return m
};
h=c("./page_view.coffee");
d.exports=g=(function(k){f(j,k);
function j(){return j.__super__.constructor.apply(this,arguments)
}j.prototype.events={"hover .js-tooltip-trigger":"showTooltipSticky","change select":"handleCalendarRulesSelectChange"};
j.prototype.handleCalendarRulesSelectChange=function(o){var m,l,n;
o.preventDefault();
m=$(o.currentTarget);
l=m.closest("select").attr("name");
n={days:m.val()};
return this.saveModelForEvent(o,this.model,l,n)
};
j.prototype.template="manage_listing/calendar_rules";
j.prototype.postRender=function(){return this.initSelects()
};
j.prototype.initSelects=function(){this.createSelect({modelAttrKey:"min_days_notice",selectId:"min-days-select",currentSelection:(function(l){return function(){return l.model.get("min_days_notice").days
}
})(this),content:[[t("ml.section.calendar.preferences.min_days_notice_none"),-1],[t("ml.section.calendar.preferences.min_days_notice_tomorrow"),0],[t("ml.section.calendar.preferences.min_days_notice_number",{number:2}),1],[t("ml.section.calendar.preferences.min_days_notice_number",{number:3}),2]]});
this.createSelect({modelAttrKey:"max_days_notice",selectId:"max-days-select",currentSelection:(function(l){return function(){return l.model.get("max_days_notice").days
}
})(this),content:[[t("ml.section.calendar.preferences.max_days_notice_none"),-1],[t("ml.section.calendar.preferences.max_days_notice_number",{number:30}),30],[t("ml.section.calendar.preferences.max_days_notice_number",{number:45}),45],[t("ml.section.calendar.preferences.max_days_notice_number",{number:60}),60],[t("ml.section.calendar.preferences.max_days_notice_number",{number:90}),90]]});
return this.createSelect({modelAttrKey:"turnover_days",selectId:"turnover-days-select",currentSelection:(function(l){return function(){return l.model.get("turnover_days").days
}
})(this),content:[[t("ml.section.calendar.preferences.turnover_days_0"),0],[t("ml.section.calendar.preferences.turnover_days_number",{smart_count:1}),1],[t("ml.section.calendar.preferences.turnover_days_number",{smart_count:2}),2]]})
};
return j
})(h)
},{"./page_view.coffee":79}],36:[function(c,f,a){var d,h,b={}.hasOwnProperty,g=function(m,k){for(var j in k){if(b.call(k,j)){m[j]=k[j]
}}function l(){this.constructor=m
}l.prototype=k.prototype;
m.prototype=new l();
m.__super__=k.prototype;
return m
};
d=c("./base_view.coffee");
f.exports=h=(function(j){g(k,j);
function k(){return k.__super__.constructor.apply(this,arguments)
}k.prototype.template="manage_listing/calendar_setup_wizard";
k.prototype.availability_states=["always","sometimes","onetime"];
k.prototype.events={"click .available-always":"renderPaneViaClick","click .available-sometimes":"renderPaneViaClick","click .available-onetime":"renderPaneViaClick","click .back-to-availability":"renderAvailability","click .disabled-month":"renderAvailability","mouseenter .availability-option":"fadeOutOptions","mouseleave .availability-option":"fadeInOptions","change .availability-start":"handleAvailabilityChange","change .availability-end":"handleAvailabilityChange","click .onetime-dates a":"updateAvailabilityStartEnd"};
k.prototype.initialize=function(){this.app=this.options.app;
this.disaster=this.app.get("applicable_disaster");
return k.__super__.initialize.apply(this,arguments)
};
k.prototype.bindings=function(){this.$el.on("render:onetime",(function(l){return function(){return l.datepicker()
}
})(this));
this.listenTo(this.model,"saving:success:availability",this.syncListingAndCalendarModels);
if(this.disaster){this.$el.on("render:onetime",(function(l){return function(){return l.handleAvailabilityChange()
}
})(this))
}return k.__super__.bindings.apply(this,arguments)
};
k.prototype.postRender=function(){k.__super__.postRender.apply(this,arguments);
this.target=this.$("#wizard-container");
this.panes={availability:"manage_listing/wizard_panes/availability",always:"manage_listing/wizard_panes/always",sometimes:"manage_listing/wizard_panes/sometimes",onetime:"manage_listing/wizard_panes/one_time"};
return this.renderInitialPane()
};
k.prototype.renderInitialPane=function(){var l;
l=this.model.get("availability").type;
if(l){return this.renderPane(l)
}else{return this.renderAvailability()
}};
k.prototype.postInitialize=function(){return this.render()
};
k.prototype.availabilityOptions=function(){var l;
l=this.model.get("availability").type;
return[{title:t("ml.calendar.wizard.Always"),slug:"always",description:t("ml.calendar.wizard.Always subheader"),selected:function(){return l===this.slug
}},{title:t("ml.calendar.wizard.Sometimes"),slug:"sometimes",description:t("ml.calendar.wizard.Sometimes subheader"),selected:function(){return l===this.slug
}},{title:t("ml.calendar.wizard.One Time"),slug:"onetime",description:t("ml.calendar.wizard.One Time subheader"),selected:function(){return l===this.slug
}}]
};
k.prototype.renderPaneViaClick=function(m){var l;
this.model.set({has_ever_been_edited:true});
l=$(m.currentTarget).data("slug");
return this.renderPane(l)
};
k.prototype.renderPane=function(l,m){var n;
if(m==null){m={}
}if(_(this.availability_states).include(l)){n=_.clone(this.model.get("availability"));
n.type=l;
this.model.set("availability",n);
this.model.save();
m=_.clone(this.model.get("availability"));
if(l==="onetime"){if(!!m.start){m.start=this.convertStandardDateToLocal(m.start)
}if(!!m.end){m.end=this.convertStandardDateToLocal(m.end)
}if(this.disaster&&!m.start&&!m.end){m.start=this.convertStandardDateToLocal(new Date().toISOString());
m.end=this.convertStandardDateToLocal(this.disaster.disaster.stop_time)
}}}return _.defer((function(o){return function(){o.target.html(JST[o.panes[l]](m,{partials:JST}));
return o.$el.trigger("render:"+l)
}
})(this))
};
k.prototype.renderAvailability=function(l){if(l){l.preventDefault()
}return this.renderPane("availability",{options:this.availabilityOptions()})
};
k.prototype.datepicker=function(){$("input[name=availability-start]").datepicker({minDate:new Date()});
return $("input[name=availability-end]").datepicker({beforeShow:(function(l){return function(){var m;
m=l.readLocalDate($("input[name=availability-start]").val())||new Date();
m.setDate(m.getDate()+1);
return{minDate:m}
}
})(this)})
};
k.prototype.fadeOutOptions=function(){return this.$(".availability-option").addClass("fade")
};
k.prototype.fadeInOptions=function(){return this.$(".availability-option").removeClass("fade")
};
k.prototype.isDateValid=function(n,m){var l;
if(m==null){m=0
}l=24*60*60*1000;
return !_.isNaN(n.valueOf())&&n-new Date()>m*l
};
k.prototype.handleAvailabilityChange=function(v){var s,p,q,w,o,r,u,z,A,y,l,n,x,m;
o=this.$(".availability-start");
s=this.$(".availability-end");
r=this.$("#error_invalid_start_date");
p=this.$("#error_invalid_end_date");
w=this.$("#error_start_date_after_end_date");
q=this.$("#save-button");
o.removeClass("invalid");
s.removeClass("invalid");
r.addClass("hide");
p.addClass("hide");
w.addClass("hide");
x=o.val();
A=s.val();
n=!!x;
z=!!A;
l=this.readLocalDate(x);
u=this.readLocalDate(A);
m=this.isDateValid(l,-1);
y=this.isDateValid(u);
if(n&&!m){o.addClass("invalid");
r.removeClass("hide");
q.addClass("disabled")
}if(z&&!y){s.addClass("invalid");
p.removeClass("hide");
q.addClass("disabled")
}if(m&&y&&n&&z){if(l>=u){o.addClass("invalid");
s.addClass("invalid");
w.removeClass("hide");
return q.addClass("disabled")
}else{return q.removeClass("disabled")
}}};
k.prototype.updateAvailabilityStartEnd=function(l){var m;
if(l){l.preventDefault()
}if(!$(l.currentTarget).hasClass("disabled")){m=this.model.get("availability");
m.start=this.convertLocalDateToStandard(this.$(".availability-start").val());
m.end=this.convertLocalDateToStandard(this.$(".availability-end").val());
_.extend(this.model._changedSinceSave,{availability:m});
return this.saveModelAndTrackProgressInSection(this.model,this.$(".section-onetime-dates"))
}};
k.prototype.readLocalDate=function(l){return $.datepicker.parseDate(l)
};
k.prototype.convertStandardDateToLocal=function(l){return $.datepicker.formatDate($.datepicker.parseDate("yy-m-d",l))
};
k.prototype.convertLocalDateToStandard=function(l){var m;
m=this.readLocalDate(l);
return""+(m.getFullYear())+"-"+(m.getMonth()+1)+"-"+(m.getDate())
};
k.prototype.syncListingAndCalendarModels=function(){return $.ajax({type:"GET",url:"/calendar/single/"+(this.model.get("id")),dataType:"json",success:(function(l){return function(m){return window.bootstrap_json=m
}
})(this)})
};
return k
})(d)
},{"./base_view.coffee":34}],37:[function(d,b,g){var h,a,l,m,c,j=function(n,o){return function(){return n.apply(o,arguments)
}
},k={}.hasOwnProperty,f=function(q,o){for(var n in o){if(k.call(o,n)){q[n]=o[n]
}}function p(){this.constructor=q
}p.prototype=o.prototype;
q.prototype=new p();
q.__super__=o.prototype;
return q
};
l=d("./generic_modal.coffee");
h=d("./base_view.coffee");
m=d("./calendar_updateform_view.coffee");
c=d("o2");
b.exports=a=(function(o){f(n,o);
function n(){this.showWeekendNormal=j(this.showWeekendNormal,this);
this.showWeekendHelp=j(this.showWeekendHelp,this);
this.showWeekdayNormal=j(this.showWeekdayNormal,this);
this.showWeekdayHelp=j(this.showWeekdayHelp,this);
this.submitTooltip=j(this.submitTooltip,this);
this.cancelledTooltip=j(this.cancelledTooltip,this);
this.clearHighlights=j(this.clearHighlights,this);
this.updateHighlights=j(this.updateHighlights,this);
this.outsideClickHandler=j(this.outsideClickHandler,this);
this.hoverCalendar=j(this.hoverCalendar,this);
this.unbindCalendarHover=j(this.unbindCalendarHover,this);
this.bindCalendarHover=j(this.bindCalendarHover,this);
this.setDate=j(this.setDate,this);
this.updateCalendar=j(this.updateCalendar,this);
this.errorUpdatingCalendar=j(this.errorUpdatingCalendar,this);
this.navigate=j(this.navigate,this);
this.postInitialize=j(this.postInitialize,this);
this.postRender=j(this.postRender,this);
this.fetchAndRerenderCalendar=j(this.fetchAndRerenderCalendar,this);
this.updatePrices=j(this.updatePrices,this);
this.setWeekdayPrices=j(this.setWeekdayPrices,this);
this.setWeekendPrices=j(this.setWeekendPrices,this);
this.setTilePrices=j(this.setTilePrices,this);
this.hideAutoPriceOnCalendar=j(this.hideAutoPriceOnCalendar,this);
this.showAutoPriceOnCalendar=j(this.showAutoPriceOnCalendar,this);
return n.__super__.constructor.apply(this,arguments)
}n.prototype.template="calendar/responsive_calendar";
n.prototype.events={"change #month-dropdown":"navigate","click .previousMonth":"navigate","click .nextMonth":"navigate","click .calendarDates .active":"setDate","click .autopricing .set_weekends":"setWeekendPrices","click .autopricing .set_weekdays":"setWeekdayPrices","mouseover .price_card":"showAutoPriceOnCalendar","mouseout .price_card":"hideAutoPriceOnCalendar","click #weekday_help_trigger":"showWeekdayHelp","click #weekday_normal_trigger":"showWeekdayNormal","click #weekend_help_trigger":"showWeekendHelp","click #weekend_normal_trigger":"showWeekendNormal"};
n.prototype.showAutoPriceOnCalendar=function(r){var p,q;
p=jQuery(r.currentTarget);
q=p.data("type");
this.setTilePrices(q);
p.find(".update_prices").removeClass("disabled");
return jQuery(r.currentTarget).addClass("light-caret-top-middle")
};
n.prototype.hideAutoPriceOnCalendar=function(q){var p;
p=jQuery(q.currentTarget);
jQuery(".autoprice_hover").removeClass("autoprice_hover");
return jQuery(q.currentTarget).removeClass("light-caret-top-middle")
};
n.prototype.setTilePrices=function(p){var q;
q=this.collection[p](this.month);
return q.each((function(r){return function(s){var u;
u=r.getTileForDate(s.get("future_date"));
return jQuery(u).addClass("autoprice_hover")
}
})(this))
};
n.prototype.setWeekendPrices=function(p){p.preventDefault();
jQuery(p.currentTarget).parent().parent().fadeOut();
return this.updatePrices("weekends")
};
n.prototype.setWeekdayPrices=function(p){p.preventDefault();
jQuery(p.currentTarget).parent().parent().fadeOut();
return this.updatePrices("weekdays")
};
n.prototype.updatePrices=function(p){var q,r;
r=this.collection[p](this.month);
q={data_start_date:this.calendarData.data_start_date,hosting_id:this.calendarData.hosting["id"],dates:[],autopricing_month:this.month,autopricing_year:this.year,autopricing_type:p,autopricing_sha:this.calendarData.autoprice_sha,month:this.month,year:this.year};
_.each(r,(function(s){return function(z){var y,u,w,v,x;
x=s.calendarData.date_to_week_index[z.get("future_date")]["week"];
w=s.calendarData.date_to_week_index[z.get("future_date")]["index"];
if(s.calendarData.calendar_weeks[x]["days"][w]["schedule"]["cl"]==="av"){y=s.calendarData.calendar_weeks[x]["days"][w]["autoprice"];
v=s.calendarData.calendar_weeks[x]["days"][w]["schedule"];
u={date:v.date,autoprice:y,old_price:v.daily_price,autopricing_sha:s.calendarData.autoprice_sha};
return q.dates.push(u)
}}
})(this));
if(!this.navigating){jQuery.ajax({url:"/calendar/bulk_modify",data:q,dataType:"json",success:(function(s){return function(u){return s.trigger("newCalendar",u)
}
})(this)})
}return this.navigating=true
};
n.prototype.urlForCurrentMonthAndYear=function(){return"/calendar/single/"+this.app.listing.id+"?month="+this.month+"&year="+this.year
};
n.prototype.fetchAndRerenderCalendar=function(){jQuery.ajax({type:"GET",url:this.urlForCurrentMonthAndYear(),dataType:"json",success:this.updateCalendar,error:this.errorUpdatingCalendar});
return this.navigating=true
};
n.prototype.getTileForDate=function(p){return this.tile_cache[p]
};
n.prototype.searchForTile=function(p){var q;
q=p.split("-");
if(q[2]<10){q[2]=parseInt(q[2],10).toString()
}return this.tiles.find(".tile[data-year='"+q[0]+"'][data-month='"+q[1]+"'][data-day='"+q[2]+"']")
};
n.prototype.getRenderData=function(){if(this.collection.month_exists(this.month)){this.calendarData.weekday_price=this.calendarData.autopricing_weekday_price_for_month;
this.calendarData.weekend_price=this.calendarData.autopricing_weekend_price_for_month;
this.calendarData.has_auto_pricing=this.calendarData.show_weekday_autopricing===true||this.calendarData.show_weekend_autopricing===true
}return this.calendarData
};
n.prototype.generateTileCache=function(){this.tiles=this.$(".tile");
this.tile_cache={};
return this.tiles.each((function(p){return function(r,u){var q,v,s;
s=jQuery(u).data("year");
v=jQuery(u).data("month");
q=jQuery(u).data("day");
if(q<10){q="0"+q
}if(v<10){v="0"+v
}return p.tile_cache[""+s+"-"+v+"-"+q]=jQuery(u)
}
})(this))
};
n.prototype.postRender=function(){this.generateTileCache();
this.lastIndices=[-1,-1];
if(this.tooltip){this.tooltip.remove()
}this.tooltip=new m({model:this.getRenderData(),el:jQuery("#calendar-form")});
this.navigating=false;
this.dates=[];
this.firstTargetIndex=null;
this.halfCalendarBlock=(this.$(".tile:eq(0)").width()/2)>>0;
this.bindCalendarHover();
this.tooltip.bind("tooltip:submit",this.submitTooltip);
this.tooltip.bind("tooltip:cancelled",this.cancelledTooltip);
return this.bindOutsideClickHandler()
};
n.prototype.postInitialize=function(){var p;
this.app=this.options.app;
this.calendarData=window.bootstrap_json||{};
this.bind("newCalendar",this.updateCalendar);
this.bind("calendarRulesUpdated",this.fetchAndRerenderCalendar);
this.listenTo(this.app,"disaster:opted_out",this.fetchAndRerenderCalendar);
if(!this.setMonthAndYearFromUrl(window.location.href)){p=new Date();
this.month=p.getMonth()+1;
this.year=p.getFullYear()
}if(_.isEmpty(this.calendarData)){this.fetchAndRerenderCalendar()
}return this.render()
};
n.prototype.navigate=function(r){var s,q,p;
r.preventDefault();
if(!this.navigating){q="/";
q+=r.currentTarget.pathname;
if(r.currentTarget.search!=null){q+=r.currentTarget.search
}q=q.toString();
q=q.replace("//","/");
if(!this.setMonthAndYearFromUrl(q)){s=$(r.currentTarget).find("option:selected");
this.month=s.attr("data-month");
this.year=s.attr("data-year")
}p=(function(u){return function(v){return u.$(".calendarMonthHeader").toggleClass("loading",v)
}
})(this);
p(true);
jQuery.ajax({type:"GET",url:this.urlForCurrentMonthAndYear(),dataType:"json",success:(function(u){return function(v){return u.trigger("newCalendar",v)
}
})(this)}).always(function(){return p(false)
});
return this.navigating=true
}};
n.prototype.errorUpdatingCalendar=function(){var p;
p=new l({title:I18n.t("ml.Sorry, something went wrong."),body:I18n.t("ml.error.unable_to_load_try_again"),buttons:[{text:I18n.t("try_again"),close:true,primary:true}]});
p.render();
return p.on("click:button_0",this.fetchAndRerenderCalendar)
};
n.prototype.updateCalendar=function(p){window.bootstrap_json=this.calendarData=p;
this.tooltip.cleanup();
this.collection.clear_updated();
this.render();
return this.initO2()
};
n.prototype.setMonthAndYearFromUrl=function(q){var p;
p=q.match(/month=(\d+)&year=(\d+)/);
if(p){this.month=p[1];
this.year=p[2];
return true
}return false
};
n.prototype.setDate=function(v){var z,q,s,w,u,x,y,p,r;
z=jQuery(v.currentTarget);
this.generateTileCache();
if(this.dates.length===0){r=z.data();
this.dates=[new Date(r.year,r.month-1,r.day)];
this.firstTargetIndex=this.tiles.index(z);
p=v.target.className;
y=v.offsetX||v.originalEvent.layerX||0;
if(y<=this.halfCalendarBlock&&p.match(/tile/)){return this.firstTargetIndex--
}}else{if(this.dates.length===1){q=this.tiles.filter(".active");
s=q.first();
w=s.data();
u=q.last().prev();
x=u.data();
this.dates[0]=new Date(w.year,w.month-1,w.day);
this.dates[1]=new Date(x.year,x.month-1,x.day);
if(!u.next().hasClass("end")){this.dates[1].setDate(this.dates[1].getDate()+1)
}this.tooltip.openTooltip(z,this.dates);
return this.unbindCalendarHover()
}}};
n.prototype.bindCalendarHover=function(){return this.$el.on("mousemove",".tile",this.hoverCalendar)
};
n.prototype.unbindCalendarHover=function(){this.$el.off("mousemove",".tile",this.hoverCalendar);
return this.firstTargetIndex=null
};
n.prototype.hoverCalendar=function(w){var y,s,v,x,p,q,u,r;
y=jQuery(w.currentTarget);
v=this.tiles.index(y)-1;
q=w.target.className;
x=w.offsetX||w.originalEvent.layerX||0;
if((x>this.halfCalendarBlock||q.match(/(content|day|icon)/))&&!y.hasClass("tile-previous")){v++
}else{if(y.hasClass("tile-previous")&&!y.hasClass("left")&&!y.hasClass("right")){return
}}if(this.dates.length===0){u=[v,v],p=u[0],s=u[1]
}else{if(this.dates.length===1){r=v<=this.firstTargetIndex?[v,this.firstTargetIndex]:[this.firstTargetIndex,v],p=r[0],s=r[1]
}}if(this.lastIndices[0]!==p||this.lastIndices[1]!==s){this.lastIndices=[p,s];
return this.updateHighlights(this.tiles,p,s)
}};
n.prototype.bindOutsideClickHandler=function(){this.unbindOutsideClickHandler();
return $(document).on("click",this.outsideClickHandler)
};
n.prototype.unbindOutsideClickHandler=function(){return $(document).off("click",this.outsideClickHandler)
};
n.prototype.outsideClickHandler=function(q){var p;
p=jQuery(q.target);
if(p.closest(".tile, .calendar-availability_form, .ui-datepicker").length===0){return this.tooltip.cancelTooltip()
}};
n.prototype.updateHighlights=function(q,s,p){var r;
q.removeClass("active").removeClass("start").removeClass("end");
r=q.slice(s,p+1).filter(":not(.tile-previous)");
s=0;
p=r.length;
r=r.slice(s,p);
r.addClass("active");
r.slice(0,1).addClass("start");
return r.last().next().addClass("end").addClass("active")
};
n.prototype.clearHighlights=function(p){return p.removeClass("active start end")
};
n.prototype.clearDates=function(){this.dates=[];
this.bindCalendarHover();
return this.clearHighlights(this.tiles)
};
n.prototype.cancelledTooltip=function(){return this.clearDates()
};
n.prototype.submitTooltip=function(p){if(!this.navigating){p=jQuery.extend({},p,{month:this.month,year:this.year});
jQuery.ajax({url:"/calendar/modify_calendar",type:"POST",data:p,dataType:"json",error:(function(q){return function(r){if(r.status===500){jQuery("#server-error").show()
}else{jQuery("#update-error").show()
}return q.navigating=false
}
})(this),success:(function(q){return function(r){return q.trigger("newCalendar",r)
}
})(this)})
}return this.navigating=true
};
n.prototype.showWeekdayHelp=function(){jQuery("#price_holder_weekday .price_card").hide();
return jQuery("#price_holder_weekday .help_text").fadeIn()
};
n.prototype.showWeekdayNormal=function(p){p.preventDefault();
jQuery("#price_holder_weekday .help_text").hide();
return jQuery("#price_holder_weekday .price_card").fadeIn()
};
n.prototype.showWeekendHelp=function(){jQuery("#price_holder_weekend .price_card").hide();
return jQuery("#price_holder_weekend .help_text").fadeIn()
};
n.prototype.showWeekendNormal=function(p){p.preventDefault();
jQuery("#price_holder_weekend .help_text").hide();
return jQuery("#price_holder_weekend .price_card").fadeIn()
};
n.prototype.cleanup=function(){this.tooltip.cleanup();
this.unbindOutsideClickHandler();
return n.__super__.cleanup.apply(this,arguments)
};
return n
})(h)
},{"./base_view.coffee":34,"./calendar_updateform_view.coffee":38,"./generic_modal.coffee":56,o2:"o2"}],38:[function(c,a,f){var g,k,b,h=function(l,m){return function(){return l.apply(m,arguments)
}
},j={}.hasOwnProperty,d=function(o,m){for(var l in m){if(j.call(m,l)){o[l]=m[l]
}}function n(){this.constructor=o
}n.prototype=m.prototype;
o.prototype=new n();
o.__super__=m.prototype;
return o
};
b=c("o2");
g=c("../../../views/base_view.coffee");
a.exports=k=(function(m){d(l,m);
function l(){this.tooltipChangeAvailability=h(this.tooltipChangeAvailability,this);
this.submitTooltip=h(this.submitTooltip,this);
this.cancelTooltip=h(this.cancelTooltip,this);
this.openTooltip=h(this.openTooltip,this);
this.postInitialize=h(this.postInitialize,this);
this.validateDate=h(this.validateDate,this);
this.postRender=h(this.postRender,this);
return l.__super__.constructor.apply(this,arguments)
}l.prototype.template="calendar/calendar_update_form_o2_nml";
l.prototype.events={"click .cancel":"cancelTooltip","submit form":"submitTooltip","click .radio_label":"tooltipChangeAvailability","change [name=starting_date]":"validateDate","change [name=stopping_date]":"validateDate"};
l.prototype.getRenderData=function(){return this.model
};
l.prototype.postRender=function(){this.$("input[name=starting_date]").datepicker();
return this.$("input[name=stopping_date]").datepicker()
};
l.prototype.validateDate=function(v){var u,q,n,p,o,s;
q=jQuery(v.target);
n=q.parents("form");
u=n.find("button[type=submit]");
s=new RegExp("^"+jQuery.datepicker._defaults.dateFormat.replace(/yy/,"yyyy").replace(/\w/g,"\\d")+"$");
o=s.exec(q.val());
if((o!=null?o.length:void 0)>0){p=moment(o[0],jQuery.datepicker._defaults.dateFormat.replace(/yy/,"yyyy").toUpperCase());
q.toggleClass("invalid",this.isInvalidDate(p))
}else{q.addClass("invalid")
}if(q.parent().parent().find("input.invalid").length>0){return u.addClass("disabled")
}else{return u.removeClass("disabled")
}};
l.prototype.isInvalidDate=function(o){var n;
n=moment();
return isNaN(o.date())||o.year()>(n.year()+3)||(o.year()<n.year()||(o.year()===n.year()&&(o.month()<n.month()||(o.month()===n.month()&&o.date()<n.date()))))
};
l.prototype.postInitialize=function(){return this.render()
};
l.prototype.openTooltip=function(n,p){var o;
this.$("input[name=starting_date]").datepicker("setDate",p[0]);
this.$("input[name=stopping_date]").datepicker("setDate",p[1]);
this.$("textarea[name=notes]").val(jQuery(".active .reservation-notes:first .icon").attr("aria-label"));
this.$("input[value=Available]").trigger("click");
this.$(".radio_label_Available").trigger("click");
if((o=this.tooltip)!=null){o.dispose()
}this.tooltip=new b.Tooltip(this.$el,n,{event:"none"});
return this.tooltip.show()
};
l.prototype.cancelTooltip=function(p){var o,n;
if(p!=null){p.preventDefault()
}if((o=this.tooltip)!=null){o.hide()
}if((n=this.$("form")[0])!=null){n.reset()
}this.tooltipChangeAvailability();
return this.trigger("tooltip:cancelled")
};
l.prototype.submitTooltip=function(o){var n;
o.preventDefault();
n=this.$("form");
if(!(n.find(".error").length>0)){return this.trigger("tooltip:submit",n.serializeObject())
}};
l.prototype.tooltipChangeAvailability=function(p){var n,o;
this.$(".radio_label").removeClass("active");
if(p){n=$(p.currentTarget);
o=n.attr("for");
n.addClass("active")
}return this.$("#availability-available").toggle(o==="opt_Available")
};
l.prototype.cleanup=function(){var n;
this.$("input[name=starting_date] input[name=stopping_date]").datepicker("destroy");
if((n=this.tooltip)!=null){n.dispose()
}return l.__super__.cleanup.apply(this,arguments)
};
return l
})(g)
},{"../../../views/base_view.coffee":95,o2:"o2"}],39:[function(g,d,k){var n,p,q,b,h,a,c,l,f,m=function(r,s){return function(){return r.apply(s,arguments)
}
},o={}.hasOwnProperty,j=function(v,s){for(var r in s){if(o.call(s,r)){v[r]=s[r]
}}function u(){this.constructor=v
}u.prototype=s.prototype;
v.prototype=new u();
v.__super__=s.prototype;
return v
};
p=g("../models/calendar_rules.coffee");
q=g("./calendar_rules_view.coffee");
b=g("./calendar_single_view_nml.coffee");
f=g("o2");
c=g("./page_view.coffee");
l=g("./performance_analytics_view.coffee");
a=g("./calendar_setup_wizard.coffee");
n=g("../models/calendar_autopricing.coffee");
d.exports=h=(function(s){j(r,s);
function r(){this.refreshData=m(this.refreshData,this);
return r.__super__.constructor.apply(this,arguments)
}r.prototype.initialize=function(){r.__super__.initialize.apply(this,arguments);
this.app=this.options.app;
this.subviews=[];
this.prepareAutoprices();
return this.bind("render:dom_inserted",this.renderCalendarOrWizard)
};
r.prototype.template="manage_listing/calendar";
r.prototype.tracking_name="calendar";
r.prototype.events={"hover #wizard-container":"showTooltipSticky","hover #tooltip-help-calendar":"showTooltipSticky","click .js-calendar-sync":"openCalendarSyncModal"};
r.prototype.bodyClassName="wide-content-section";
r.prototype.shouldDisplayWizard=function(){return !this.model.get("has_ever_been_available")
};
r.prototype.renderCalendarOrWizard=function(){if(this.shouldDisplayWizard()){this.calendarView=new a({app:this.app,el:this.$("#calendar"),collection:this.auto_prices,model:this.model})
}else{$.post("/calendar/uptodate?hosting_id="+(this.model.get("id")));
this.calendarView=new b({app:this.app,el:this.$("#calendar"),collection:this.auto_prices});
this.calendarView.on("newCalendar",this.refreshData);
this.performanceAnalyticsView=new l({app:this.app,el:this.$("#performance-analytics"),model:this.model});
this.performanceAnalyticsView.render();
this.subviews.push(this.performanceAnalyticsView)
}this.subviews.push(this.calendarView);
if(this.app.get("calendar_rules_experiment")&&this.model.get("has_ever_been_available")){return this.initCalendarRules()
}};
r.prototype.initCalendarRules=function(){this.calendarRules=new p({listing_id:this.model.get("id")});
this.calendarRulesView=new q({app:this.app,el:this.$("#calendar-rules"),model:this.calendarRules});
this.subviews.push(this.calendarRulesView);
this.calendarRules.fetch().then((function(u){return function(){return u.calendarRulesView.render()
}
})(this));
return this.calendarRules.on("request",(function(u){return function(w,x,v){return x.success(function(){return u.calendarView.trigger("calendarRulesUpdated")
})
}
})(this))
};
r.prototype.refreshData=function(u){return window.bootstrap_json=u
};
r.prototype.prepareAutoprices=function(){this.auto_prices=new n(window.autoprices);
return this.auto_prices.group_dates_into_month_collections()
};
r.prototype.openCalendarSyncModal=function(w){var u,v;
w.preventDefault();
this.app.trigger("calendar_sync","modal_opened");
u=window.location.origin+("/calendar/ical/"+this.app.listing.id+".ics?s="+(this.app.get("ical_sig")));
v=JST["manage_listing/calendar_sync_modal"]({iCalDownloadLink:u});
this.modalEl=$(v);
this.modalEl.on("click",".js-import-calendar",(function(x){return function(y){return x.app.trigger("calendar_sync","import_link_clicked")
}
})(this));
this.modalEl.on("click",".js-export-calendar",(function(x){return function(y){return x.app.trigger("calendar_sync","ical_link_clicked")
}
})(this));
this.calendarSyncModal=new f.Modal(this.modalEl);
this.calendarSyncModal.open();
return this.calendarSyncModal.on("close",(function(x){return function(){x.calendarSyncModal.dispose();
return x.modalEl=null
}
})(this))
};
return r
})(c)
},{"../models/calendar_autopricing.coffee":9,"../models/calendar_rules.coffee":10,"./calendar_rules_view.coffee":35,"./calendar_setup_wizard.coffee":36,"./calendar_single_view_nml.coffee":37,"./page_view.coffee":79,"./performance_analytics_view.coffee":80,o2:"o2"}],40:[function(d,b,g){var m,h,a,o,c,k,j,l=function(p,q){return function(){return p.apply(q,arguments)
}
},n={}.hasOwnProperty,f=function(s,q){for(var p in q){if(n.call(q,p)){s[p]=q[p]
}}function r(){this.constructor=s
}r.prototype=q.prototype;
s.prototype=new r();
s.__super__=q.prototype;
return s
};
m=d("./apple_turnover_view.coffee");
o=d("./disaster_alert_view.coffee");
j=d("./welcome_new_host_modal_view.coffee");
k=d("../tracking.coffee");
c=d("./header_view.coffee");
h=d("./base_view.coffee");
b.exports=a=(function(q){f(p,q);
function p(){this.showAppleTurnover=l(this.showAppleTurnover,this);
this.displayErrorFlash=l(this.displayErrorFlash,this);
return p.__super__.constructor.apply(this,arguments)
}p.prototype.initialize=function(){var r;
this.app=this.options.app;
this.model=this.app.listing;
r=new c({app:this.app,el:"#js-manage-listing-header",model:this.app.listing}).render();
this.on("updateContent",this.afterUpdateContent,this);
this.app.listing.on("change:has_ever_been_available",this.hasEverBeenAvailable,this);
this.app.router.on("all",this.afterNavigate,this);
this.listenTo(this.app.listing,"saving:error",this.displayErrorFlash);
this.tracker=new k({el:this.el,app:this.app,model:this.app.listing});
return this.$(".language-curr-picker .dropdown-menu").addClass("bottom-up")
};
p.prototype.events={"click .apple-turnover-trigger":"showAppleTurnover"};
p.prototype.postRender=function(){p.__super__.postRender.apply(this,arguments);
this.hasEverBeenAvailable();
this.initDisasterFlash();
return this.initModals()
};
p.prototype.initDisasterFlash=function(){var s,r;
s=this.app.get("applicable_disaster");
if(s){return r=new o({app:this.app,disaster:s,model:this.app.listing}).render()
}};
p.prototype.initModals=function(){var r;
r=this.model.get("has_ever_been_edited");
if(!this.app.get("user_is_suspended")){if(!r){return this.initWelcomeNewHostModalView()
}}};
p.prototype.initWelcomeNewHostModalView=function(){return this.welcomeNewHostModalView=new j({model:this.model,app:this.app})
};
p.prototype.hasEverBeenAvailable=function(){if(this.app.listing.get("has_ever_been_available")){this.$el.addClass("has-been-listed");
return this.$el.removeClass("never-listed")
}else{this.$el.addClass("never-listed");
return this.$el.removeClass("has-been-listed")
}};
p.prototype.updateContent=function(r){$(window).scrollTop(0);
this.$containerEl.children().detach();
this.$containerEl.append(r);
return this.trigger("updateContent")
};
p.prototype.render=function(){this._preRender();
this.$containerEl=this.$("#js-manage-listing-content");
this.$navbar=this.$("#js-manage-listing-nav");
this.$header=this.$("#js-manage-listing-header");
this.trigger("render");
this._postRender();
this._hasRendered=true;
return this
};
p.prototype.displayErrorFlash=function(){return Flash.error(t("ml.error.generic_saving_error",{link_start:"<a href='"+(this.app.get("contact_support_url"))+"'>",link_end:"</a>"}))
};
p.prototype.showAppleTurnover=function(r){r.preventDefault();
this.appleTurnover=new m({model:this.model});
return this.appleTurnover.render()
};
return p
})(h)
},{"../tracking.coffee":25,"./apple_turnover_view.coffee":33,"./base_view.coffee":34,"./disaster_alert_view.coffee":55,"./header_view.coffee":65,"./welcome_new_host_modal_view.coffee":86}],41:[function(d,a,g){var l,k,m,b,h,c,j={}.hasOwnProperty,f=function(q,o){for(var n in o){if(j.call(o,n)){q[n]=o[n]
}}function p(){this.constructor=q
}p.prototype=o.prototype;
q.prototype=new p();
q.__super__=o.prototype;
return q
};
c=d("o2");
m=d("../models/cleaning_job.coffee");
b=d("../models/cleaning_preference.coffee");
k=d("./cleaning_helper_view.coffee");
a.exports=l=(function(o){f(n,o);
function n(){return n.__super__.constructor.apply(this,arguments)
}n.prototype.template="manage_listing/cleaning/automatic_modal";
n.prototype.events={"click .js-freq-modal-submit":"submitFreqChange","click .js-freq-modal-cancel":"cancelFreqChange","change .js-schedule-for-future":"scheduleForFutureChange","change select":"stopEvent"};
n.prototype.initialize=function(p){this.app=p.app;
this.model=p.model;
return this.scheduleForFuture=false
};
n.prototype.modal=function(){var p;
p=this.$(".js-freq-modal");
return p.data()["o2-modal"]
};
n.prototype.getRenderData=function(){var p;
p=this.app.get("upcoming_reservations");
return{model:this.model.data(),show_save_button:this.model.isNew(),days:this.dayOffset(this.SELECT_OPTIONS.day_offset[this.model.get("schedule_type")],this.model),start_times:this.startTimes(this.SELECT_OPTIONS.start_time,this.model),can_schedule:m.canScheduleForReservations(p,this.model)}
};
n.prototype.open=function(){return this.modal().open()
};
n.prototype.close=function(){return this.modal().close()
};
n.prototype.submitFreqChange=function(){Airbnb.Tracking.logEvent({event_name:"cleaning",event_data:{sub_event:"automatic_scheduling",schedule_all_upcoming:this.scheduleForFuture}});
return this.trigger("submit",{scheduleForFuture:this.scheduleForFuture,values:h(this.$el)})
};
n.prototype.cancelFreqChange=function(){return this.trigger("cancel")
};
n.prototype.stopEvent=function(p){return p.stopPropagation()
};
n.prototype.scheduleForFutureChange=function(){return this.scheduleForFuture=!this.scheduleForFuture
};
n.prototype.cleanup=function(){var p;
return(p=this.freqModal)!=null?p.dispose():void 0
};
return n
})(k);
h=function(o){var n;
n={};
o.find("select").each(function(){var p,q;
p=$(this).attr("name");
q=$(this).val();
return n[p]=q
});
return n
}
},{"../models/cleaning_job.coffee":11,"../models/cleaning_preference.coffee":13,"./cleaning_helper_view.coffee":43,o2:"o2"}],42:[function(d,a,g){var n,j,l,b,m,k,c,h={}.hasOwnProperty,f=function(r,p){for(var o in p){if(h.call(p,o)){r[o]=p[o]
}}function q(){this.constructor=r
}q.prototype=p.prototype;
r.prototype=new q();
r.__super__=p.prototype;
return r
};
c=d("o2");
l=d("../models/cleaning_job.coffee");
b=d("../models/cleaning_preference.coffee");
j=d("./cleaning_helper_view.coffee");
m=d("./cleaning_laundry_view.coffee");
a.exports=n=(function(o){f(p,o);
function p(){return p.__super__.constructor.apply(this,arguments)
}p.prototype.template="manage_listing/cleaning/cleaning_form_modal";
p.prototype.events={"click .js-submit-cleaning-form":"addCleaningJob"};
p.prototype.initialize=function(q){p.__super__.initialize.call(this);
this.app=q.app;
this.pref=q.preference;
this.reservation=q.reservation;
this.listing=q.listing;
this.subviews=[];
return this.on("render:dom_inserted",(function(r){return function(){r.modal().on("close",function(){return r.trigger("close")
});
return r.modal().on("open",function(){return r.trigger("open")
})
}
})(this))
};
p.prototype.modal=function(){var q;
q=this.$(".modal");
return q.data()["o2-modal"]
};
p.prototype.postRender=function(){this.laundryInputs=new m({app:this.app,listing:this.listing,model:this.pref});
this.subviews.push(this.laundryInputs);
this.$(".js-laundry-inputs").append(this.laundryInputs.render().el);
return k(this.pref,this.$el,this.SELECT_OPTIONS)
};
p.prototype.getRenderData=function(){var u,r,s,q,v;
r=new l({schedule_type:this.pref.get("schedule_type")});
u=r.isCheckin();
q=u?this.reservation.start_date:this.reservation.end_date;
v="Cleaning before check-in";
if(!u){v="Cleaning after check-out"
}s={before:u,date:q,title:v,button_text:"Book Cleaning",days:this.dayOffset(this.SELECT_OPTIONS.day_offset[r.get("schedule_type")],r),partner_info:this.app.get("cleaning_partner_info"),schedule_type:r.get("schedule_type"),start_times:this.startTimes(this.SELECT_OPTIONS.start_time,r)};
return s
};
p.prototype.addCleaningJob=function(u){var q,s,r;
u.preventDefault();
q=this.$el.find(".alert-danger");
q.addClass("hide");
this.$el.find(".modal-content").addClass("loading");
s={schedule_type:this.$el.find("#schedule-type").val(),day_offset:this.$el.find("#day-offset").val(),start_time:this.$el.find("#start-time").val()};
_.extend(s,{reservation_code:this.reservation.confirmation_code});
_.extend(s,this.laundryInputs.data());
r=new l(s);
return r.save({},{syncEverything:true,success:(function(v){return function(){return v.trigger("success",r)
}
})(this),error:(function(v){return function(x,y){var w;
w=JSON.parse(y.responseText);
v.$el.find(".modal-content").removeClass("loading");
return q.html(w.error_message).removeClass("hide")
}
})(this)})
};
p.prototype.close=function(){if(this.modal()){return this.modal().close()
}else{return this.trigger("close")
}};
p.prototype.open=function(){return this.modal().open()
};
return p
})(j);
k=function(r,q,p){var s,o;
s=r.get("start_time");
if(r.get("frequency")!==b.FREQUENCY_AUTO){o=(Math.round(new Date().getTime()/600000)+r.get("hosting_id"))%p.start_time.length;
s=p.start_time[o].value
}if(r&&q){q.find("#day-offset").val(r.get("day_offset"));
return q.find("#start-time").val(s)
}else{q.find("#days-from-checkin").val("-1");
return q.find("#start-time").val("09:00")
}}
},{"../models/cleaning_job.coffee":11,"../models/cleaning_preference.coffee":13,"./cleaning_helper_view.coffee":43,"./cleaning_laundry_view.coffee":45,o2:"o2"}],43:[function(f,h,c){var g,b,a,d={}.hasOwnProperty,j=function(n,l){for(var k in l){if(d.call(l,k)){n[k]=l[k]
}}function m(){this.constructor=n
}m.prototype=l.prototype;
n.prototype=new m();
n.__super__=l.prototype;
return n
};
a=f("../models/cleaning_preference.coffee");
g=f("./base_view.coffee");
h.exports=b=(function(l){j(k,l);
function k(){return k.__super__.constructor.apply(this,arguments)
}k.prototype.SELECT_OPTIONS={laundry_service:[{text:"No additional service",value:a.LAUNDRY_NONE},{text:"Airbnb Linen service",value:a.LAUNDRY_LINENS},{text:"Laundry service",value:a.LAUNDRY_SERVICE}],laundry_loads:[{text:"1 load",value:1},{text:"2 loads",value:2},{text:"3 loads",value:3},{text:"4 loads",value:4},{text:"5 loads",value:5},{text:"6 loads",value:6},{text:"7 loads",value:7},{text:"8 loads",value:8},{text:"9 loads",value:9},{text:"10 loads",value:10}],num_beds:[{text:"0",value:0},{text:"1 set",value:1},{text:"2 sets",value:2},{text:"3 sets",value:3},{text:"4 sets",value:4},{text:"5 sets",value:5},{text:"6 sets",value:6},{text:"7 sets",value:7},{text:"8 sets",value:8},{text:"9 sets",value:9},{text:"10 sets",value:10}],day_offset:{before_checkin:[{text:"Two days before check-in",value:a.DAY_OFFSET_TWO_BEFORE},{text:"Day before check-in",value:a.DAY_OFFSET_ONE_BEFORE},{text:"Day of check-in",value:a.DAY_OFFSET_SAME_DAY}],after_checkout:[{text:"Day of check-out",value:a.DAY_OFFSET_SAME_DAY},{text:"Day after check-out",value:a.DAY_OFFSET_ONE_AFTER},{text:"Two days after check-out",value:a.DAY_OFFSET_TWO_AFTER}]},start_time:[{text:"09:00am",value:"09:00"},{text:"09:30am",value:"09:30"},{text:"10:00am",value:"10:00"},{text:"10:30am",value:"10:30"},{text:"11:00am",value:"11:00"},{text:"11:30am",value:"11:30"},{text:"12:00pm",value:"12:00"},{text:"12:30pm",value:"12:30"},{text:"1:00pm",value:"13:00"},{text:"1:30pm",value:"13:30"},{text:"2:00pm",value:"14:00"},{text:"2:30pm",value:"14:30"},{text:"3:00pm",value:"15:00"},{text:"3:30pm",value:"15:30"},{text:"4:00pm",value:"16:00"},{text:"4:30pm",value:"16:30"},{text:"5:00pm",value:"17:00"},{text:"5:30pm",value:"17:30"},{text:"6:00pm",value:"18:00"},{text:"6:30pm",value:"18:30"},{text:"7:00pm",value:"19:00"},{text:"7:30pm",value:"19:30"},{text:"8:00pm",value:"20:00"}]};
k.prototype.bedroomOptions=function(m){return _.map(this.app.get("bedrooms"),(function(n){return function(o){return{text:o[0],value:o[1],selected:o[1]===m.get("bedrooms")}
}
})(this))
};
k.prototype.bathroomOptions=function(m){return _.map(this.app.get("bathrooms"),(function(n){return function(o){return{text:o[0],value:o[1],selected:o[1]===m.get("bathrooms")}
}
})(this))
};
k.prototype.laundryOptions=function(m){return this.selectOptions(this.SELECT_OPTIONS.laundry_service,m.get("laundry_service"))
};
k.prototype.laundryLoadOptions=function(m){return this.selectOptions(this.SELECT_OPTIONS.laundry_loads,m.get("laundry_loads"))
};
k.prototype.selectOptions=function(n,m){return _.map(n,function(p){return _.extend(_.clone(p),{selected:m==p.value})
})
};
k.prototype.allFields=function(m,n){return m.find("input, select, textarea").each((function(o){return function(p,r){var q;
q=$(r);
if(!q.is("[type=radio]:not(:checked)")){return n(q,p)
}}
})(this))
};
k.prototype.bedTypes=function(o,r,n){var m,s,u,p,q;
m=2;
q=[];
p=_.rest(o,0);
while(p.length>0){u=_.take(p,m);
p=_.rest(p,m);
s=_.map(u,(function(v){return function(w){return{bed_type:w.value,bed_key:w.key,bed_type_options:v.selectOptions(r,parseInt(n.get(w.key)))}
}
})(this));
q.push({bed_type_cols:s})
}return q
};
k.prototype.dayOffset=function(n,m){return this.selectOptions(n,m.get("day_offset"))
};
k.prototype.startTimes=function(n,m){return this.selectOptions(n,m.get("start_time"))
};
k.prototype.navigate=function(n){var m;
n.preventDefault();
m=$(n.target);
return this.app.router.navigate(m.attr("href"),{trigger:true})
};
return k
})(g)
},{"../models/cleaning_preference.coffee":13,"./base_view.coffee":34}],44:[function(g,c,j){var s,n,q,o,d,p,m,k,b,f,a,r,l={}.hasOwnProperty,h=function(x,v){for(var u in v){if(l.call(v,u)){x[u]=v[u]
}}function w(){this.constructor=x
}w.prototype=v.prototype;
x.prototype=new w();
x.__super__=v.prototype;
return x
};
f=g("o2");
m=f.Modal;
d=g("../models/cleaning_preference.coffee");
q=g("../models/cleaning_job.coffee");
n=g("./cleaning_helper_view.coffee");
s=g("./cleaning_form_view.coffee");
p=g("./cleaning_laundry_view.coffee");
c.exports=o=(function(u){var w;
h(v,u);
function v(){return v.__super__.constructor.apply(this,arguments)
}v.prototype.template="manage_listing/cleaning/cleaning_job";
v.prototype.events={"click .js-open-cancel-confirmation-modal":"openCancelConfirmationModal","click .open-cleaning-form":"openCleaningForm","click .toggle-job-details":"toggleJobDetails","click .js-edit-day-time":"editDayAndTime","click .js-edit-bed-bath":"editBedAndBath","click .js-edit-entry":"editEntry","click .js-edit-fridge":"editFridge","click .js-edit-additional-info":"editAdditionalInfo","click .js-edit-trash":"editTrash","click .js-edit-linens":"editLinens","click .js-edit-rooms-to-clean":"editRoomsToClean"};
v.prototype.initialize=function(x){this.hidden=true;
this.job=x.job;
this.reservation=x.reservation;
this.pref=x.preference;
this.app=x.app;
this.listing=this.app.listing;
this.type=x.schedule_type;
this.jobFormView=null;
if(this.job){this.listenTo(this.job,"change",(function(y){return function(){return y.render()
}
})(this));
return this.listenTo(this.job,"change:start_time",(function(y){return function(z,B){var A;
A=_.find(y.SELECT_OPTIONS.start_time,function(C){return C.value===B
});
return y.job.set("start_time_formatted",A.text)
}
})(this))
}};
v.prototype.cleanup=function(){var x;
v.__super__.cleanup.call(this);
return(x=this.jobFormView)!=null?x.cleanup():void 0
};
v.prototype.modelForField=function(){return this.job
};
v.prototype.getRenderData=function(){var A,z,y,C,B,x,D;
x=null;
A=k(this.type);
z=b(this.type);
if(this.job){y=this.SELECT_OPTIONS.day_offset[this.job.get("schedule_type")];
D=_.find(y,(function(E){return function(G){var F;
F=E.job;
return G.value==F.get("day_offset")
}
})(this));
B=this.app.listing.get("room_type")!=="Entire home/apt";
x=_.extend({},this.job.data(),{day_offset_text:D!=null?D.text:void 0,fridge_cleaning:!this.job.cleanNothing(),trash_truncated:r(this.job.get("trash_disposal")),entry_truncated:r(this.job.get("entry_and_exit_instructions")),info_truncated:r(this.job.get("additional_info")),no_laundry_service:this.job.noLaundryService(),has_linen_service:this.job.linenService(),has_laundry_service:this.job.laundryService(),hidden:this.hidden,completed:this.job.isCompleted(),editable:!(A&&this.reservation.disable_before_clean_button),show_rooms_to_clean:B||this.job.roomDiff(this.app.listing),rooms_to_clean_truncated:r(this.job.get("rooms_to_clean"))})
}C=!this.job&&((A&&this.reservation.disable_before_clean_button)||(z&&this.reservation.disable_after_clean_button));
return{disabled:C,active:!C,reservation:this.reservation,partner_info:this.app.get("cleaning_partner_info"),job:x,reservation:this.reservation,is_checkin_job:A}
};
v.prototype.openCancelConfirmationModal=function(A){var y,x,z;
A.preventDefault();
z=JST["manage_listing/cleaning/cancel-confirmation-modal"];
y=$(z(this.job.data()));
x=new m(y);
x.open();
y.on("click",".js-cancel-cleaning",(function(B){return function(C){C.preventDefault();
y.find(".modal-content").addClass("loading");
return B.cancelCleaningJob(function(D){if(D){Flash.error(["Oh no! We're having trouble canceling this cleaning.","Please contact",B.app.get("cleaning_partner_info").name,"at",B.app.get("cleaning_partner_info").phone+"."].join(" "));
return x.close()
}else{return x.close()
}})
}
})(this));
return x.on("close",(function(B){return function(){return x.dispose()
}
})(this))
};
v.prototype.cancelCleaningJob=function(z){var x,y;
y=this.job.get("id");
x={reservation_code:this.reservation.confirmation_code,schedule_type:this.job.get("schedule_type")};
return jQuery.ajax({type:"POST",url:Airbnb.Api.getUrl("/v1/cleaning_jobs/delete"),data:{cleaning_job:x},dataType:"json",success:(function(A){return function(C){var B;
B=A.reservation.cleaning_jobs.get(y);
A.reservation.cleaning_jobs.remove(B);
if(z!=null){z()
}return A.render()
}
})(this),error:(function(A){return function(){if(z!=null){return z("Failed")
}}
})(this)})
};
v.prototype.openCleaningForm=function(x){x.preventDefault();
if(this.pref.isNew()){this.openPrefInterstitial();
return
}this.jobFormView=new s({app:this.app,preference:this.pref,reservation:this.reservation,listing:this.listing});
this.$el.append(this.jobFormView.render().el);
this.jobFormView.trigger("render:dom_inserted");
this.jobFormView.open();
this.listenTo(this.jobFormView,"close",(function(y){return function(){var z;
if((z=y.jobFormView)!=null){z.cleanup()
}return y.jobFormView=null
}
})(this));
return this.listenTo(this.jobFormView,"success",(function(y){return function(z){y.reservation.cleaning_jobs.add(z);
y.jobFormView.close();
return y.render()
}
})(this))
};
v.prototype.openPrefInterstitial=function(){var A,B,y,z,x;
x=a(this.type,this.reservation);
z=JST["manage_listing/cleaning/interstitial"];
y=z({link:x,before:k(this.type)});
B=$(y);
A=new m(B);
A.open();
A.on("close",function(){return A.dispose()
});
return B.one("click",".js-navigate-prefs",(function(C){return function(D){D.preventDefault();
A.close();
return C.app.router.navigate(x,{trigger:true})
}
})(this))
};
v.prototype.toggleJobDetails=function(y){var x;
y.preventDefault();
x=this.$el.find(".js-job-details");
x.toggleClass("hide");
return this.hidden=x.is(".hide")
};
v.prototype.openEditModal=function(D,x,B){var z,y,A,C;
A=JST["manage_listing/cleaning/edit_modal"];
z=$(A({title:D,body:x,job:this.job.data()}));
y=new m(z);
z.on("click",".js-ml-link",(function(E){return function(F){y.close();
return E.navigate(F)
}
})(this));
y.open();
C=f.bind(z);
y.on("close",(function(E){return function(){y.dispose();
_.each(C,function(F){return F.dispose()
});
return B!=null?B.call(E):void 0
}
})(this));
z.one("click",".js-submit-edit",(function(E){return function(G){var F,H;
G.preventDefault();
E.allFields(z,function(I){return E.updateFromField(I)
});
F=z.find(".panel-body");
F.addClass("loading");
H=E.job.get("estimated_total_cost");
return E.job.save({},{include:["reservation_code","schedule_type"],success:function(){y.close();
E.reservation.cleaning_jobs.trigger("sync");
return E.openConfirmEditModal(H!==E.job.get("estimated_total_cost"))
},error:function(){Flash.error(["Oh no! We're having trouble editing this cleaning.","Please contact cleaning-feedback@airbnb.com."].join(" "));
y.on("close",function(){return $("html, body").animate({scrollTop:0})
});
y.close();
return E.reservation.cleaning_jobs.trigger("sync")
}})
}
})(this));
return z
};
v.prototype.openConfirmEditModal=function(A){var y,x,z;
z=JST["manage_listing/cleaning/confirm_edit_modal"];
y=$(z({job:this.job.data(),price_difference:A}));
x=new m(y);
x.open();
return x.on("close",function(){return x.dispose()
})
};
w=function(y,z,x){return v.prototype[y]=function(C){var B,A;
C.preventDefault();
A=x.body.call(this);
B=this.openEditModal(z,A,x.cleanup);
if(x.postRender){return x.postRender.call(this,B)
}}
};
w("editDayAndTime","Day and time",{body:function(){var x;
x=JST["manage_listing/cleaning/edit_date_and_time"];
return x({days:this.dayOffset(this.SELECT_OPTIONS.day_offset[this.job.get("schedule_type")],this.job),start_times:this.startTimes(this.SELECT_OPTIONS.start_time,this.job),is_checkin:this.job.isCheckin(),reservation:this.reservation})
}});
w("editBedAndBath","Bedrooms and bathrooms",{body:function(){var x;
x=JST["manage_listing/cleaning/edit_bed_and_bath"];
return x({bedrooms:this.bedroomOptions(this.job),bathrooms:this.bathroomOptions(this.job),is_checkin:this.job.isCheckin(),reservation:this.reservation,job:this.job.data()})
}});
w("editRoomsToClean","Rooms to clean",{body:function(){var x;
x=JST["manage_listing/cleaning/edit_rooms_to_clean"];
return x({job:this.job.data()})
}});
w("editLinens","Laundry service or Airbnb linens",{body:function(){var x;
x=JST["manage_listing/cleaning/edit_laundry"];
return x({reservation:this.reservation,job:this.job.data(),bed_type_rows:this.bedTypes(this.app.get("cleaning_bed_types"),this.SELECT_OPTIONS.num_beds,this.job),linen_service:this.job.linenService()})
},postRender:function(x){this.laundryInputs=new p({app:this.app,listing:this.listing,model:this.job});
return x.find(".js-laundry-inputs").append(this.laundryInputs.render().el)
},cleanup:function(){return this.laundryInputs.cleanup()
}});
w("editTrash","Trash disposal",{body:function(){var x;
x=JST["manage_listing/cleaning/edit_trash"];
return x({is_checkin:this.job.isCheckin(),reservation:this.reservation,job:this.job.data()})
}});
w("editEntry","Entry and exit",{body:function(){var x;
x=JST["manage_listing/cleaning/edit_entry"];
return x({is_checkin:this.job.isCheckin(),reservation:this.reservation,job:this.job.data(),listing:this.listing.data(),return_type:"schedule",partner_info:this.app.get("cleaning_partner_info"),model:this.job.data(),has_key:this.job.get("entry_and_exit_keep_key")==="has_key",keep_key:this.job.get("entry_and_exit_keep_key")==="keep"},{partials:JST})
}});
w("editFridge","Refrigerator cleaning",{body:function(){var x;
x=JST["manage_listing/cleaning/edit_fridge"];
return x({is_checkin:this.job.isCheckin(),reservation:this.reservation,CLEAN_NOTHING:d.CLEAN_NOTHING,CLEAN_FOOD:d.CLEAN_FOOD,clean_nothing:this.job.cleanNothing(),job:this.job.data()})
}});
w("editAdditionalInfo","Additional instructions",{body:function(){var x;
x=JST["manage_listing/cleaning/edit_additional_instructions"];
return x({is_checkin:this.job.isCheckin(),reservation:this.reservation,job:this.job.data()})
}});
return v
})(n);
b=function(u){return u===q.SCHEDULE_TYPE_CHECKOUT
};
k=function(u){return !b(u)
};
r=function(u){if(!u){return u
}if(u.length>160){return u.slice(0,160)+"..."
}else{return u
}};
a=function(w,u){var v;
v="";
if(b(w)){v="#after-checkout"
}if(u){v+="?reservation_id="+u.id
}return"cleaning-preferences"+v
}
},{"../models/cleaning_job.coffee":11,"../models/cleaning_preference.coffee":13,"./cleaning_form_view.coffee":42,"./cleaning_helper_view.coffee":43,"./cleaning_laundry_view.coffee":45,o2:"o2"}],45:[function(f,b,h){var k,l,c,m,d,a,j={}.hasOwnProperty,g=function(q,o){for(var n in o){if(j.call(o,n)){q[n]=o[n]
}}function p(){this.constructor=q
}p.prototype=o.prototype;
q.prototype=new p();
q.__super__=o.prototype;
return q
};
d=f("o2");
l=f("../models/cleaning_job.coffee");
c=f("../models/cleaning_preference.coffee");
k=f("./cleaning_helper_view.coffee");
b.exports=m=(function(o){g(n,o);
function n(){return n.__super__.constructor.apply(this,arguments)
}n.prototype.template="manage_listing/cleaning/laundry_inputs";
n.prototype.events={"change .js-linens-select":"changeLinens","change .js-bed-type":"renderLinenErrors","change .js-laundry-loads":"renderLaundryErrors"};
n.prototype.initialize=function(p){n.__super__.initialize.call(this);
this.app=p.app;
return this.model=p.model
};
n.prototype.postRender=function(){return setTimeout((function(p){return function(){if(p.model.linenService()){p.renderLinenErrors()
}if(p.model.laundryService()){return p.renderLaundryErrors()
}}
})(this),0)
};
n.prototype.getRenderData=function(){var r,p,q;
p=this.laundryOptions(this.model);
q=this.laundryLoadOptions(this.model);
r=_.find(q,function(s){return s.selected
});
return{bed_type_rows:this.bedTypes(this.app.get("cleaning_bed_types"),this.SELECT_OPTIONS.num_beds,this.model),laundry_options:p,laundry_load_options:q,selected:a(p),model:this.model.data(),load_selected:r}
};
n.prototype.data=function(){var p;
p={laundry_service:this.$(".js-linens-select").val(),linen_location:this.$(".js-linen-location").val(),laundry_loads:this.$(".js-laundry-loads").val(),laundry_location:this.$(".js-laundry-location").val()};
this.$(".js-bed-type").each(function(){var q;
q=$(this);
return p[q.attr("name")]=q.val()
});
return p
};
n.prototype.changeLinens=function(v){var q,u,p,r,s;
r=$(v.target);
u=this.$el.find(".js-linens-bed-settings");
p=this.$el.find(".js-linen-location");
q=this.$el.find(".js-laundry-settings");
s=[p,u,q];
_.each(s,function(w){return w.addClass("hide")
});
this.hideErrors();
switch(r.val()){case c.LAUNDRY_NONE:return p.removeClass("hide");
case c.LAUNDRY_LINENS:u.removeClass("hide");
return this.renderLinenErrors();
case c.LAUNDRY_SERVICE:q.removeClass("hide");
return this.renderLaundryErrors()
}};
n.prototype.flashErrors=function(){if(this.hasLaundryErrors()){Flash.error("Please select the number of laundry loads to wash.")
}else{if(this.hasLinenErrors()){Flash.error("Please select the quantity and type of linens.")
}}return $("html, body").animate({scrollTop:0})
};
n.prototype.hasErrors=function(){return this.hasLinenErrors()||this.hasLaundryErrors()
};
n.prototype.hasLaundryErrors=function(){var p;
if(this.$(".js-linens-select").val()!==c.LAUNDRY_SERVICE){return false
}p=this.$(".js-laundry-loads");
return p.val()===null||parseInt(p.val())===0
};
n.prototype.hasLinenErrors=function(){var r,q,p;
if(this.$(".js-linens-select").val()!==c.LAUNDRY_LINENS){return false
}p=false;
q=_.pluck(ManageListing.app.get("cleaning_bed_types"),"key");
r=this.$(".js-bed-type");
if(q){r.each(function(){var s;
s=$(this);
if(parseInt(s.val())!==0){return p=true
}})
}return !p
};
n.prototype.renderLaundryErrors=function(){if(this.hasLaundryErrors()){return this.showLaundryErrors()
}else{return this.hideLaundryErrors()
}};
n.prototype.renderLinenErrors=function(){if(this.hasLinenErrors()){return this.showLinenErrors()
}else{return this.hideLinenErrors()
}};
n.prototype.showLinenErrors=function(){return this.$(".js-linens-error").removeClass("hide")
};
n.prototype.hideErrors=function(){this.hideLinenErrors();
return this.hideLaundryErrors()
};
n.prototype.hideLinenErrors=function(){return this.$(".js-linens-error").addClass("hide")
};
n.prototype.showLaundryErrors=function(){return this.$(".js-laundry-question").addClass("text-highlight text-strong")
};
n.prototype.hideLaundryErrors=function(){return this.$(".js-laundry-question").removeClass("text-highlight text-strong")
};
return n
})(k);
a=function(n){return _.reduce(n,function(p,o){p[o.value]=o.selected;
return p
},{})
}
},{"../models/cleaning_job.coffee":11,"../models/cleaning_preference.coffee":13,"./cleaning_helper_view.coffee":43,o2:"o2"}],46:[function(d,a,j){var o,n,b,f,h,p,q,l,c,m={}.hasOwnProperty,g=function(v,s){for(var r in s){if(m.call(s,r)){v[r]=s[r]
}}function u(){this.constructor=v
}u.prototype=s.prototype;
v.prototype=new u();
v.__super__=s.prototype;
return v
},k=[].slice;
c=d("o2");
b=d("../models/cleaning_preference.coffee");
n=d("./cleaning_helper_view.coffee");
p=d("./cleaning_laundry_view.coffee");
o=d("./cleaning_automatic_modal_view.coffee");
h=d("./cleaning_schedule_modal_view.coffee");
a.exports=f=(function(r){g(s,r);
function s(){return s.__super__.constructor.apply(this,arguments)
}s.prototype.template="manage_listing/cleaning/preference-form";
s.prototype.events={"change input:not(.ml-disable-autosave)":"handleBlur","change select:not(.js-schedule-select)":"handleBlur","change .js-schedule-select":"changeFrequency","blur textarea":"handleBlur","click .js-submit-cleaning-form":"createPreference","click .js-show-advanced":"showAdvanced","click .js-ml-link":"navigate"};
s.prototype.initialize=function(u){s.__super__.initialize.apply(this,arguments);
this.subviews=[];
this.app=this.options.app;
this.listing=this.options.listing;
this.setPreference(this.options.cleaning_preference);
this.freqModal=null;
this.reservation=null;
this.shouldScheduleForFuture=false;
if(this.options.reservationId){this.reservation=_.find(this.app.get("upcoming_reservations"),(function(v){return function(w){return w.id===v.options.reservationId
}
})(this))
}this.listenTo(this.model,"change:bedrooms",(function(v){return function(){return v.changeRooms()
}
})(this));
this.listenTo(this.model,"change:bathrooms",(function(v){return function(){return v.changeRooms()
}
})(this));
this.listenTo(this.listing,"change:bedrooms",(function(v){return function(){return v.changeRooms()
}
})(this));
return this.listenTo(this.listing,"change:bathrooms",(function(v){return function(){return v.changeRooms()
}
})(this))
};
s.prototype.cleanup=function(){var u;
s.__super__.cleanup.call(this);
return(u=this.manualModal)!=null?u.dispose():void 0
};
s.prototype.getRenderData=function(){var w,v,u;
u=this.app.get("upcoming_reservations");
v=_.flatten(_.map(u,function(x){return x.cleaning_jobs.models
}));
w=this.model.get("additional_info")!=="";
w=w||this.model.get("refrigerator_cleaning")!==b.CLEAN_NOTHING;
return{partner_info:this.app.get("cleaning_partner_info"),advanced:w,automatic:this.model.automatic(),bedrooms:this.bedroomOptions(this.model),bathrooms:this.bathroomOptions(this.model),CLEAN_NOTHING:b.CLEAN_NOTHING,CLEAN_FOOD:b.CLEAN_FOOD,MANUAL:b.FREQUENCY_MANUAL,AUTO:b.FREQUENCY_AUTO,clean_nothing:this.model.cleanNothing(),cleaning_preference:this.model.data(),days:this.dayOffset(this.SELECT_OPTIONS.day_offset[this.model.get("schedule_type")],this.model),show_save_button:this.model.isNew(),save_will_schedule:!!this.reservation,start_times:this.startTimes(this.SELECT_OPTIONS.start_time,this.model),hide_day_and_time:this.shouldHideDayAndTime(),show_rooms_to_clean:this.showRoomsToClean(),return_type:"preference",has_cleanings:v.length!==0,has_many_cleanings:v.length>1,num_cleanings:v.length,model:this.model.data(),has_key:this.model.get("entry_and_exit_keep_key")==="has_key",keep_key:this.model.get("entry_and_exit_keep_key")==="keep",listing:this.listing.data()}
};
s.prototype.postRender=function(){this.laundryInputs=new p({app:this.app,listing:this.listing,model:this.model});
this.subviews.push(this.laundryInputs);
this.$(".js-laundry-inputs").append(this.laundryInputs.render().el);
this.autoModal=new o({app:this.app,model:this.model});
this.subviews.push(this.autoModal);
this.$el.append(this.autoModal.render().el);
this.listenTo(this.autoModal,"submit",(function(u){return function(v){return u.submitFreqChange(v)
}
})(this));
return this.listenTo(this.autoModal,"cancel",(function(u){return function(){return u.cancelFreqChange()
}
})(this))
};
s.prototype.changeRooms=function(){var u;
u=this.$el.find(".js-rooms-to-clean");
if(this.showRoomsToClean()){return u.removeClass("hide")
}else{return u.addClass("hide")
}};
s.prototype.showRoomsToClean=function(){if(this.listing.get("room_type")!=="Entire home/apt"){return true
}return !l(this.model,this.listing,"bedrooms","bathrooms")
};
s.prototype.shouldHideDayAndTime=function(){return !this.model.automatic()&&!this.reservation
};
s.prototype.attemptHideDayAndTime=function(){if(this.shouldHideDayAndTime()){return this.$el.find(".js-auto-scheduling").addClass("hide")
}};
s.prototype.attemptShowDayAndTime=function(){return this.$el.find(".js-auto-scheduling").removeClass("hide")
};
s.prototype.setPreference=function(u){this.model=u;
return q(this.model,this.listing,"bedrooms","bathroom")
};
s.prototype.changeFrequency=function(u){if($(u.currentTarget).val()===b.FREQUENCY_AUTO){this.showAutoModal();
return this.attemptShowDayAndTime()
}else{this.handleBlur(u);
this.attemptHideDayAndTime();
return this.showManualModal()
}};
s.prototype.showManualModal=function(){var u,v;
u=$("#js-manual-modal-"+(this.model.get("schedule_type")));
v=u.data()["o2-modal"];
if(!v){v=this.manualModal=new c.Modal(u)
}return v.open()
};
s.prototype.showAutoModal=function(){return this.autoModal.open()
};
s.prototype.cancelFreqChange=function(){this.$(".js-schedule-select").val(b.FREQUENCY_MANUAL);
return this.attemptHideDayAndTime()
};
s.prototype.submitFreqChange=function(x){var y,w,v,u;
this.shouldScheduleForFuture=x.scheduleForFuture;
this.model.set("frequency",b.FREQUENCY_AUTO);
u=x.values;
for(v in u){this.model.set(v,u[v]);
w=this.$("select[name="+v+"]").val(u[v])
}y=$(".js-schedule-section");
if(!this.model.isNew()){this.saveModelAndTrackProgressInSection(this.model,y);
if(this.shouldScheduleForFuture){return this.scheduleForFuture()
}}};
s.prototype.scheduleForFuture=function(v){var u,w,x;
w=this.app.get("upcoming_reservations");
u=CleaningJob.fillInReservations(w,this.model);
x=new h({app:this.app,jobs:u});
x.on("close",function(){x.cleanup();
_.each(w,function(y){return y.cleaning_jobs.pruneUnsynced()
});
if(v){return v()
}});
this.$el.append(x.render().el);
return x.trigger("render:dom_inserted")
};
s.prototype.createPreference=function(u){u.preventDefault();
if(this.laundryInputs.hasErrors()){this.laundryInputs.flashErrors();
return
}this.$el.addClass("loading");
this.allFields(this.$el,(function(v){return function(w){return v.updateFromField(w)
}
})(this));
return this.model.save({},{syncEverything:true,success:(function(v){return function(){var w;
if(v.reservation){w=CleaningJob.fromPreference(v.model,v.reservation);
return w.save({},{syncEverything:true,success:function(){v.reservation.cleaning_jobs.add(w);
return v.onCreateSuccess()
},error:function(){return v.onCreateFailure()
}})
}else{return v.onCreateSuccess()
}}
})(this),error:(function(v){return function(){return v.onCreateFailure()
}
})(this)})
};
s.prototype.onCreateSuccess=function(){var u;
this.$el.removeClass("loading");
this.render();
u=(function(v){return function(){return v.app.router.navigate("cleaning-schedule",{trigger:true})
}
})(this);
if(this.shouldScheduleForFuture){return this.scheduleForFuture(u)
}else{return u()
}};
s.prototype.onCreateFailure=function(){this.$el.removeClass("loading");
this.render();
return this.listing.trigger("saving:error")
};
s.prototype.handleBlur=function(u){if(this.model.isNew()){return this.handleBlurWithoutSave(u)
}else{return s.__super__.handleBlur.call(this,u)
}};
s.prototype.showAdvanced=function(u){u.preventDefault();
this.$el.find(".js-advanced-options").removeClass("hide");
return $(u.currentTarget).addClass("hide")
};
return s
})(n);
q=function(){var u,s,r;
s=arguments[0],r=arguments[1],u=3<=arguments.length?k.call(arguments,2):[];
return _.each(u,function(v){var w;
w=s.get("key");
if(typeof w==="undefined"){return s.set(r.get(v))
}})
};
l=function(){var u,w,v,s,x,r;
v=arguments[0],s=arguments[1],w=3<=arguments.length?k.call(arguments,2):[];
for(x=0,r=w.length;
x<r;
x++){u=w[x];
if(v.get(u)!=s.get(u)){return false
}}return true
}
},{"../models/cleaning_preference.coffee":13,"./cleaning_automatic_modal_view.coffee":41,"./cleaning_helper_view.coffee":43,"./cleaning_laundry_view.coffee":45,"./cleaning_schedule_modal_view.coffee":49,o2:"o2"}],47:[function(d,b,h){var k,c,f,a,m,l,j={}.hasOwnProperty,g=function(q,o){for(var n in o){if(j.call(o,n)){q[n]=o[n]
}}function p(){this.constructor=q
}p.prototype=o.prototype;
q.prototype=new p();
q.__super__=o.prototype;
return q
};
c=d("../models/cleaning_preference.coffee");
f=d("./cleaning_preference_form_view.coffee");
m=d("./cleaning_price_estimate_view.coffee");
k=d("./cleaning_helper_view.coffee");
b.exports=a=(function(o){g(n,o);
function n(){return n.__super__.constructor.apply(this,arguments)
}n.prototype.template="manage_listing/cleaning/preferences";
n.prototype.events={"click .js-before-checkin":"showBeforeCheckin","click .js-after-checkout":"showAfterCheckout"};
n.prototype.initialize=function(){n.__super__.initialize.apply(this,arguments);
this.app=this.options.app;
this.reservationId=this.options.reservationId;
this.subviews=[];
this.afterCheckoutTab=this.options.afterCheckoutTab;
this.inserted=false;
this.on("render:dom_inserted",(function(p){return function(){p.inserted=true;
return _.each(p.subviews,function(q){return q.trigger("render:dom_inserted")
})
}
})(this));
this.beforeCheckinPreference=c.extractFromListing(this.model,c.SCHEDULE_TYPE_CHECKIN);
return this.afterCheckoutPreference=c.extractFromListing(this.model,c.SCHEDULE_TYPE_CHECKOUT)
};
n.prototype.postRender=function(){this.beforeCheckInView=new f({app:this.app,cleaning_preference:this.beforeCheckinPreference,listing:this.model,reservationId:this.afterCheckoutTab?null:this.reservationId});
this.subviews.push(this.beforeCheckInView);
this.$("#tab-before-checkin").append(this.beforeCheckInView.render().el);
this.afterCheckoutView=new f({app:this.app,cleaning_preference:this.afterCheckoutPreference,listing:this.model,reservationId:this.afterCheckoutTab?this.reservationId:null});
this.subviews.push(this.afterCheckoutView);
this.$("#tab-after-checkout").append(this.afterCheckoutView.render().el);
this.beforePriceEstimateView=new m({app:this.app,listing:this.model,model:this.beforeCheckinPreference});
this.subviews.push(this.beforePriceEstimateView);
this.$el.append(this.beforePriceEstimateView.render().el);
this.afterPriceEstimateView=new m({app:this.app,listing:this.model,model:this.afterCheckoutPreference});
this.subviews.push(this.afterPriceEstimateView);
this.$el.append(this.afterPriceEstimateView.render().el);
this.beforePriceEstimateView.show();
this.bindPreferenceDestroy(c.SCHEDULE_TYPE_CHECKIN);
this.bindPreferenceDestroy(c.SCHEDULE_TYPE_CHECKOUT);
if(this.afterCheckoutTab){if(this.inserted){return l()
}else{return this.once("render:dom_inserted",l)
}}};
n.prototype.showBeforeCheckin=function(){this.beforePriceEstimateView.show();
return this.afterPriceEstimateView.hide()
};
n.prototype.showAfterCheckout=function(){this.beforePriceEstimateView.hide();
return this.afterPriceEstimateView.show()
};
n.prototype.bindPreferenceDestroy=function(u){var s,q,r,p;
r=null;
q=null;
s=null;
if(u===c.SCHEDULE_TYPE_CHECKIN){r="beforeCheckinPreference";
q=this.beforeCheckInView;
s=this.beforePriceEstimateView
}else{r="afterCheckoutPreference";
q=this.afterCheckoutView;
s=this.afterPriceEstimateView
}p=this[r];
return p.once("destroy",(function(v){return function(){v.model.cleaningPreferences().remove(p);
p=v[r]=new c({schedule_type:c.SCHEDULE_TYPE_CHECKIN},{listing:v.model});
v.model.cleaningPreferences().add(p);
v.bindPreferenceDestroy(u);
q.setPreference(p);
return s.setPreference(p)
}
})(this))
};
return n
})(k);
l=function(){return $(".js-after-checkout").click()
}
},{"../models/cleaning_preference.coffee":13,"./cleaning_helper_view.coffee":43,"./cleaning_preference_form_view.coffee":46,"./cleaning_price_estimate_view.coffee":48}],48:[function(c,b,g){var j,a,k,d,h={}.hasOwnProperty,f=function(o,m){for(var l in m){if(h.call(m,l)){o[l]=m[l]
}}function n(){this.constructor=o
}n.prototype=m.prototype;
o.prototype=new n();
o.__super__=m.prototype;
return o
};
a=c("../models/cleaning_price_estimate.coffee");
j=c("./cleaning_helper_view.coffee");
b.exports=k=(function(m){f(l,m);
function l(){return l.__super__.constructor.apply(this,arguments)
}l.prototype.template="manage_listing/cleaning/price-estimate";
l.prototype.className="hide";
l.prototype.initialize=function(n){l.__super__.initialize.call(this,n);
this.app=n.app;
this.initialPos=0;
this.fixed=false;
this.initialPos=-1;
this.hidden=true;
this.inserted=false;
this.loading=false;
this.debouncedRender=_.debounce(((function(o){return function(){return o.render()
}
})(this)),50);
this.once("render:dom_inserted",(function(o){return function(){return o.inserted=true
}
})(this));
this.throttled=_.throttle(((function(o){return function(){return o.updateFixed()
}
})(this)),10);
$(window).on("scroll",this.throttled);
this.priceEstimate=a.fromPreference(this.app,this.model,{listing:n.listing});
this.priceEstimate.bindToPreference(this.model,this.app);
this.priceEstimate.on("change",(function(o){return function(){return o.debouncedRender()
}
})(this));
this.priceEstimate.on("pull:start",(function(o){return function(){o.loading=true;
return o.debouncedRender()
}
})(this));
return this.priceEstimate.on("pull:complete",(function(o){return function(){o.loading=false;
return o.debouncedRender()
}
})(this))
};
l.prototype.cleanup=function(){l.__super__.cleanup.call(this);
$(window).off("scroll",this.throttled);
return this.priceEstimate.unbindFromPreference(this.model)
};
l.prototype.getRenderData=function(){return{loading:this.loading,bedrooms:this.model.get("bedrooms"),bathrooms:this.model.get("bathrooms"),linen_service:this.model.linenService(),laundry_service:this.model.laundryService(),estimated_laundry_cost:this.priceEstimate.get("estimated_laundry_cost"),estimated_linen_cost:this.priceEstimate.get("linen_price"),estimated_total_cost:this.priceEstimate.get("estimated_total_cost"),show_discount:this.priceEstimate.hasDiscount(),discount_percent:this.priceEstimate.discountPercent(),estimated_discount_amount:this.priceEstimate.get("estimated_discount_amount"),estimated_subtotal_cost:this.priceEstimate.get("estimated_subtotal_cost"),fixed:this.fixed,partner_info:this.app.get("cleaning_partner_info")}
};
l.prototype.setPreference=function(n){this.priceEstimate.unbindFromPreference(this.model);
this.priceEstimate.bindToPreference(n,this.app);
return this.priceEstimate.updateFromPreference(this.model,this.app)
};
l.prototype.$column=function(){return this.$el.find(".js-price-estimate")
};
l.prototype.show=function(){this.hidden=false;
this.$el.removeClass("hide");
return this.throttled()
};
l.prototype.hide=function(){this.hidden=true;
return this.$el.addClass("hide")
};
l.prototype.fix=function(){if(!this.fixed){this.fixed=true;
return this.$column().addClass("fixed")
}};
l.prototype.unfix=function(){if(this.fixed){this.fixed=false;
return this.$column().removeClass("fixed")
}};
l.prototype.updateFixed=function(){if(this.hidden){return
}if(!this.inserted){return
}if(this.initialPos<0){this.initialPos=this.$column().offset().top
}if(d(this.initialPos)){return this.fix()
}else{return this.unfix()
}};
return l
})(j);
d=function(m){var l;
l=$(window).scrollTop();
return l-m>=-67
}
},{"../models/cleaning_price_estimate.coffee":15,"./cleaning_helper_view.coffee":43}],49:[function(f,g,b){var a,j,d,c={}.hasOwnProperty,h=function(n,l){for(var k in l){if(c.call(l,k)){n[k]=l[k]
}}function m(){this.constructor=n
}m.prototype=l.prototype;
n.prototype=new m();
n.__super__=l.prototype;
return n
};
a=f("./cleaning_helper_view.coffee");
g.exports=j=(function(k){h(l,k);
function l(){return l.__super__.constructor.apply(this,arguments)
}l.prototype.template="manage_listing/cleaning/schedule_modal";
l.prototype.initialize=function(m){this.app=m.app;
this.jobs=m.jobs;
this.saved=0;
this.failed=0;
this.modalClosed=false;
this.modal=null;
return this.on("render:dom_inserted",(function(n){return function(){n.initO2();
if(n.jobs.length===0){n.close();
return
}n.modal=n.$(".modal").data()["o2-modal"];
n.modal.on("close",function(){n.modalClosed=true;
return n.close()
});
n.modal.open();
return d(n.jobs,_.bind(n.progress,n),_.bind(n.finish,n))
}
})(this))
};
l.prototype.getRenderData=function(){return{count:this.jobs.length,plural:this.jobs.length>1}
};
l.prototype.progress=function(m){if(m){return this.failed++
}else{return this.$(".js-schedule-count").text(++this.saved)
}};
l.prototype.close=function(){if(this.modal&&!this.modalClosed){this.modal.close();
this.modalClosed=true
}return this.trigger("close")
};
l.prototype.finish=function(){this.$(".js-ok").attr("disabled",false);
this.$(".js-progress").addClass("hide");
if(this.failed===0){return this.$(".js-success").removeClass("hide")
}else{this.$(".js-err").removeClass("hide");
return this.$(".js-num-failed").text(this.failed)
}};
return l
})(a);
d=function(q,k,p){var u,n,l,r,o,s,m;
u=q.length;
n=false;
r=function(v){u--;
k(v);
if(!n&&u<=0){n=true;
if(p){return p()
}}};
m=[];
for(o=0,s=q.length;
o<s;
o++){l=q[o];
m.push(l.save({},{syncEverything:true,success:function(){return r()
},error:function(){return r("failed saving job")
}}))
}return m
}
},{"./cleaning_helper_view.coffee":43}],50:[function(d,b,h){var c,j,g,a,l,k={}.hasOwnProperty,f=function(p,n){for(var m in n){if(k.call(n,m)){p[m]=n[m]
}}function o(){this.constructor=p
}o.prototype=n.prototype;
p.prototype=new o();
p.__super__=n.prototype;
return p
};
l=d("./reservation_view.coffee");
c=d("../models/cleaning_preference.coffee");
g=d("./next_cleaning_job_view.coffee");
a=d("./page_view.coffee");
b.exports=j=(function(n){f(m,n);
function m(){return m.__super__.constructor.apply(this,arguments)
}m.prototype.template="manage_listing/cleaning/index";
m.prototype.events={"click .set-bedrooms-and-bathrooms":"handleClickWithRouter","click .set-cleaning-preferences":"handleClickWithRouter"};
m.prototype.initialize=function(){this.app=this.options.app;
this.router=this.options.router;
this.subviews=[];
this.rerenderCallback=(function(o){return function(){return o.render()
}
})(this);
_.each(this.app.get("upcoming_reservations"),(function(o){return function(p){p.cleaning_jobs.on("add",o.rerenderCallback);
return p.cleaning_jobs.on("remove",o.rerenderCallback)
}
})(this));
this.beforeCheckinPreference=c.extractFromListing(this.app.listing,c.SCHEDULE_TYPE_CHECKIN);
this.afterCheckoutPreference=c.extractFromListing(this.app.listing,c.SCHEDULE_TYPE_CHECKOUT);
return m.__super__.initialize.apply(this,arguments)
};
m.prototype.cleanup=function(){m.__super__.cleanup.call(this);
return _.each(this.app.get("upcoming_reservations"),(function(o){return function(p){p.cleaning_jobs.off("add",o.rerenderCallback);
return p.cleaning_jobs.off("remove",o.rerenderCallback)
}
})(this))
};
m.prototype.postRender=function(){var o,p;
o=this.$(".js-reservation-list");
_.each(this.app.get("upcoming_reservations"),(function(q){return function(s){var u;
u=new l({app:q.app,reservation:s,beforeCheckinPreference:q.beforeCheckinPreference,afterCheckoutPreference:q.afterCheckoutPreference});
q.subviews.push(u);
return o.append(u.render().el)
}
})(this));
p=new g({app:this.app,upcoming_reservations:this.app.get("upcoming_reservations")});
this.subviews.push(p);
this.$el.append(p.render().el);
if(!this.app.listing.get("has_viewed_cleaning")){this.app.listing.set("has_viewed_cleaning",true);
return this.app.listing.save()
}};
m.prototype.getRenderData=function(){var o;
o=m.__super__.getRenderData.apply(this,arguments);
return{listing:o.listing,bedrooms:this.bedrooms(),cleaning:{cleaning_price_estimate:this.app.get("cleaning_price_estimate"),partner_info:this.app.get("cleaning_partner_info")},showReservationList:this.app.get("upcoming_reservations").length>0,profileComplete:this.profileComplete(),mustSpecifyNumBedrooms:this.mustSpecifyNumBedrooms(),prefHref:$(".nav-cleaning-preferences a").attr("href"),isNew:this.beforeCheckinPreference.isNew()&&this.afterCheckoutPreference.isNew(),userId:Airbnb.userAttributes.id}
};
m.prototype.profileComplete=function(){return(this.bedrooms()!=null)&&this.model.get("bathrooms")
};
m.prototype.mustSpecifyNumBedrooms=function(){return this.model.get("room_type")==="Entire home/apt"
};
m.prototype.bedrooms=function(){if(this.mustSpecifyNumBedrooms()){return this.model.get("bedrooms")
}else{return 1
}};
return m
})(a)
},{"../models/cleaning_preference.coffee":13,"./next_cleaning_job_view.coffee":76,"./page_view.coffee":79,"./reservation_view.coffee":84}],51:[function(d,b,g){var k,l,a,m,c,h=function(n,o){return function(){return n.apply(o,arguments)
}
},j={}.hasOwnProperty,f=function(q,o){for(var n in o){if(j.call(o,n)){q[n]=o[n]
}}function p(){this.constructor=q
}p.prototype=o.prototype;
q.prototype=new p();
q.__super__=o.prototype;
return q
};
c=d("o2");
a=d("./page_view.coffee");
m=enderRequire("apps/security_check");
l=d("./list_space_modal_view.coffee");
b.exports=k=(function(o){f(n,o);
function n(){this.fileUploaded=h(this.fileUploaded,this);
this.uploadFile=h(this.uploadFile,this);
this.initializeUploader=h(this.initializeUploader,this);
this.securityCheckSatisfied=h(this.securityCheckSatisfied,this);
return n.__super__.constructor.apply(this,arguments)
}n.prototype.initialize=function(){var p;
n.__super__.initialize.apply(this,arguments);
this.app=this.options.app;
this.router=this.options.router;
this.on("render:dom_inserted",this.initializeUploader);
if(this.options.listNow){p=new l({app:this.app,model:this.app.listing,router:this.app.router});
p.render()
}return this.model.on("change:extra_user_info",(function(q){return function(){return q.rerender()
}
})(this))
};
n.prototype.tracking_name="complete_profile";
n.prototype.bodyClassName="full-bleed-content-section";
n.prototype.events={"click .phone-modal":"addPhoneNumber","click .facebook-connect":"fbConnect","click #complete-list-it":"handleListSpaceClick"};
n.prototype.handleListSpaceClick=function(r){var q,p;
r.preventDefault();
q=$(r.currentTarget);
if(q.hasClass("disabled")){return
}if(this.model.isReadyToList()){p=new l({app:this.app,model:this.app.listing,router:this.app.router});
return p.render()
}else{if(q.data("track")==="list_space_button_left_nav"){this.app.trigger("listing_space","list_space_left_nav_click_and_verify_profile")
}return this.router.navigateToBestRoute()
}};
n.prototype.getRenderData=function(){return _.extend(n.__super__.getRenderData.apply(this,arguments),{masked_phone:this.maskPhoneNumber(),isReadyToList:this.isReadyToList(),showSecurityCheck:this.showSecurityCheck()})
};
n.prototype.showSecurityCheck=function(){var p;
return this.phoneNumber()&&((p=this.model.get("extra_user_info"))!=null?p.has_profile_pic:void 0)&&this.app.get("security_check_required")
};
n.facebookSave=function(){return ManageListing.app.listing.save({facebook_connect:ManageListing.app.getFBCookie()})
};
n.prototype.fbConnect=Airbnb.Utils.fbButtonClickHandlerFactory("manage listing",n.facebookSave);
n.prototype.template="manage_listing/complete_profile";
n.prototype.phoneNumber=function(){var p;
return(p=this.model.get("extra_user_info"))!=null?p.phone_number:void 0
};
n.prototype.maskPhoneNumber=function(){var p,s,q,r;
q=(r=this.phoneNumber())!=null?r.number_formatted:void 0;
if(!q){return false
}p="<span class=bullet>&#9618;</span>";
s=q.slice(q.length-2,q.length);
return"("+(p+p+p)+") "+(p+p+p)+" - "+(p+p)+s
};
n.prototype.isReadyToList=function(){return this.model.isReadyToList()
};
n.prototype.addPhoneNumber=function(){this.$(".bottom-content").addClass("loading");
return this.model.fetch().then((function(p){return function(){if(p._verification_markup){return p.openPhoneModal(p._verification_markup)
}else{return p.getVerificationMarkup().then(function(q){return p.openPhoneModal(q)
})
}}
})(this))
};
n.prototype.getVerificationMarkup=function(){return $.get("/verification/phone_verification_modal")
};
n.prototype.openPhoneModal=function(r){var u,q,s,p;
this._verification_markup||(this._verification_markup=r);
u=$("body");
s=new c.Modal(r);
p="#phone-verification-modal";
q=this.model.get("extra_user_info").phone_number;
s.on("open",function(){var w,v;
$(".bottom-content").removeClass("loading");
w=$.phoneNumberVerifyWidget({showAddNumberInitially:true,element:p,phone_number_id:q!=null?q.id:void 0,onComplete:(function(x){return function(){var y;
u.trigger("phone_modal_event","phone_modal_complete");
s.close();
return(y=x.model)!=null?y.fetch():void 0
}
})(this)});
v=w.data("phoneNumberVerifyWidget");
if(q!=null?q.id:void 0){v.stepTwo();
return u.trigger("phone_modal_event","phone_modal_open_with_phone_number_id")
}else{v.stepOne();
return u.trigger("phone_modal_event","phone_modal_open_without_phone_number_id")
}});
s.on("close",(function(v){return function(){$(p).remove();
return v.model.fetch().then(function(){return v.rerender()
})
}
})(this));
return s.open()
};
n.prototype.rerender=function(){var p;
p=this.$("#photo-upload-container");
if(this.uploader&&this.uploader.runtime==="html4"){p=p.clone(true)
}this.render();
return this.$("#photo-upload-container").replaceWith(p)
};
n.prototype.postRender=function(){if(this.isReadyToList()){this.app.trigger("impression",{getTrackingKey:function(){return"pre_list_list_space_button_profile"
}})
}if(this.showSecurityCheck()){return new m(this.$el.find("#security_check_panel"),{activityType:"manage_listing",challenge:this.app.get("security_check_challenge"),successCallback:this.securityCheckSatisfied})
}};
n.prototype.securityCheckSatisfied=function(){this.app.set("security_check_required",false);
this.rerender();
return this.trigger("render:dom_inserted")
};
n.prototype.initializeUploader=function(){if(!(this.$("#upload-profile-pic").length>0)){return
}this.uploader=new plupload.Uploader({runtimes:"html5,flash,html4",browse_button:"upload-profile-pic",container:"photo-upload-container",flash_swf_url:"/swf/plupload.flash.swf",silverlight_xap_url:"/xap/plupload.silverlight.xap",url:this.model.authenticatedUrlForMethod("update"),multipart:true,multi_selection:false,file_data_name:"profile_pic",multipart_params:Airbnb.Api.params(),headers:{"X-CSRF-Token":Airbnb.getCSRFToken()}});
this.uploader.bind("UploadComplete",this.fileUploaded);
this.uploader.init();
return this.uploader.bind("FilesAdded",this.uploadFile)
};
n.prototype.uploadFile=function(p){this.$(".user-photo-content").addClass("loading");
return this.uploader.start()
};
n.prototype.fileUploaded=function(r,q,p){if(p!=null){this.model.set(this.model.parse(JSON.parse(p.response)));
return this.app.trigger("profile_photo","upload_photo")
}else{return this.model.fetch().then((function(s){return function(){return s.app.trigger("profile_photo","upload_photo")
}
})(this))
}};
return n
})(a)
},{"./list_space_modal_view.coffee":70,"./page_view.coffee":79,o2:"o2"}],52:[function(d,b,h){var g,a,c,j=function(l,m){return function(){return l.apply(m,arguments)
}
},k={}.hasOwnProperty,f=function(o,m){for(var l in m){if(k.call(m,l)){o[l]=m[l]
}}function n(){this.constructor=o
}n.prototype=m.prototype;
o.prototype=new n();
o.__super__=m.prototype;
return o
};
c=d("o2");
a=d("./page_view.coffee");
b.exports=g=(function(l){f(m,l);
function m(){this.toggle_disabled=j(this.toggle_disabled,this);
this.deleteListing=j(this.deleteListing,this);
return m.__super__.constructor.apply(this,arguments)
}m.prototype.template="manage_listing/delete_listing_modal";
m.prototype.events={"change #i_understand":"toggle_disabled","click .js-delete-listing-submit":"deleteListing"};
m.prototype.initialize=function(){this.app=this.options.app;
return m.__super__.initialize.apply(this,arguments)
};
m.prototype.postRender=function(){return this.launchModal()
};
m.prototype.launchModal=function(){this.deleteListingModal=new c.Modal(this.$el.find(".modal"));
this.deleteListingModal.open();
return this.initO2()
};
m.prototype.deleteListing=function(o){var n;
o.preventDefault();
this.$(".panel-body").addClass("loading");
n=this.$("#reason").val();
return this.model.destroy({data:{reason:n},processData:true,success:function(){if(document.location.pathname!=="/rooms"){return document.location.pathname="/rooms"
}}})
};
m.prototype.toggle_disabled=function(o){var n;
n=$(o.currentTarget).is(":checked");
if(n){return $(".js-delete-listing-submit").removeAttr("disabled")
}else{return $(".js-delete-listing-submit").attr("disabled","disabled")
}};
return m
})(a)
},{"./page_view.coffee":79,o2:"o2"}],53:[function(d,f,b){var a,j,h,c={}.hasOwnProperty,g=function(n,l){for(var k in l){if(c.call(l,k)){n[k]=l[k]
}}function m(){this.constructor=n
}m.prototype=l.prototype;
n.prototype=new m();
n.__super__=l.prototype;
return n
};
j=d("./page_view.coffee");
h=d("o2");
f.exports=a=(function(l){g(k,l);
function k(){return k.__super__.constructor.apply(this,arguments)
}k.prototype.initialize=function(){this.app=this.options.app;
this.router=this.options.router;
this.subviews=[];
this.languageNameFromLocaleMapping=_.reduce(I18n.options.languages,(function(m,n){m[n.locale]=n.locale_name;
return m
}),{});
if(!this.app.selectedDescriptionLanguageIndex){this.app.selectedDescriptionLanguageIndex=0
}this.selectedLocaleForNewDescription=null;
if(!this.isDataAvailable()){this.model.listingDescriptions().fetch().then((function(m){return function(){return m.render()
}
})(this))
}return k.__super__.initialize.apply(this,arguments)
};
k.prototype.events=function(){return{"blur input":"handleBlur","blur textarea":"handleBlur","click .multiple-description-tabs li a":"changeTab","focus input":"showTooltipSticky","focus textarea":"showTooltipSticky","mouseenter input":"showTooltipSticky","mouseenter textarea":"showTooltipSticky","click .add-first-language":"addFirstLanguage","change #language-select":"selectLanguage","click .cancel-add-language":"cancelAddLanguage","click #write-description-button":"addNewLanguage","click .remove-locale":"showDeleteConfirmationModal","click .description-tip a":"handleClickWithRouter","click #js-write-more":"navigateToDetails"}
};
k.prototype.navigateToDetails=function(m){m.preventDefault();
this.app.userManuallyOpenedDetailsSection=true;
this.app.trigger("userManuallyOpenedDetailsSection");
return this.router.handleLinkClick("/manage-listing/"+(this.model.get("id"))+"/details")
};
k.prototype.getRenderData=function(){var q,p,v,u,o,s,r,m,n;
if(this.listingDescriptions().length===1&&this.model.get("has_ever_been_available")){u=JST["manage_listing/multi-language/add-first-language-btn"]
}else{if(this.selectedListingDescriptionOrNull()&&this.showTabs()&&this.app.selectedDescriptionLanguageIndex!==0){m={languageName:this.selectedLanguageNameOrNull()};
u=JST["manage_listing/multi-language/remove-language-link"](m)
}}p={addingNewLanguage:this.app.selectedDescriptionLanguageIndex===null,extendedSubtitleContent:u,listingDescription:(n=this.selectedListingDescriptionOrNull())!=null?n.attributes:void 0,listingDescriptions:this.listingDescriptionsData(),noLanguageSelected:this.selectedLocaleForNewDescription===null,showTabs:this.showTabs(),singleLanguage:this.listingDescriptions().length===1,isDataAvailable:this.isDataAvailable()};
if(this.selectedListingDescriptionOrNull()){_.extend(p.listingDescription,this.descriptionTipRenderData());
q={attributeLengths:this.selectedListingDescriptionOrNull().attributeLengths};
_.extend(p.listingDescription,q);
s=this.app.get("listing_description_phrases");
if(s){r=this.selectedListingDescriptionOrNull().get("locale");
I18n.extend(s[r])
}}else{v={chooseText:t("ml.description.choose_language_from_menu"),selectOptions:(function(){var z,y,w,x;
w=this.availableLanguages();
x=[];
for(z=0,y=w.length;
z<y;
z++){o=w[z];
x.push({value:o.locale,label:o.locale_name,selected:o.locale===this.selectedLocaleForNewDescription})
}return x
}).call(this)};
_.extend(p,v)
}return _.extend({},k.__super__.getRenderData.apply(this,arguments),p)
};
k.prototype.postRender=function(){k.__super__.postRender.apply(this,arguments);
if(this.$(".multiple-description-tabs").length>0){return _.defer((function(m){return function(){return m.handleTabScrolling()
}
})(this))
}};
k.prototype.modelForField=function(m){return this.selectedListingDescriptionOrNull()
};
k.prototype.availableLanguages=function(){var m;
m=this.model.listingDescriptions().map(function(n){return n.get("locale")
});
return _.filter(I18n.options.languages,function(n){return !_.contains(m,n.locale)
})
};
k.prototype.selectedListingDescriptionOrNull=function(){if(this.app.selectedDescriptionLanguageIndex!=null){return this.listingDescriptions()[this.app.selectedDescriptionLanguageIndex]
}else{return null
}};
k.prototype.selectedLanguageNameOrNull=function(){var m;
m=this.selectedListingDescriptionOrNull();
if(m==null){return null
}return this.languageNameFromLocale(m.get("locale"))
};
k.prototype.listingDescriptions=function(){return this.model.listingDescriptions().models
};
k.prototype.listingDescriptionsData=function(){var o,r,q,n,p,m;
p=this.listingDescriptions();
m=[];
for(o=q=0,n=p.length;
q<n;
o=++q){r=p[o];
m.push({languageName:this.languageNameFromLocale(r.get("locale")),attributes:r.attributes,index:o,active:this.app.selectedDescriptionLanguageIndex===o})
}return m
};
k.prototype.languageNameFromLocale=function(m){return this.languageNameFromLocaleMapping[m]||m
};
k.prototype.showTabs=function(){return this.listingDescriptions().length>1||this.app.selectedDescriptionLanguageIndex===null
};
k.prototype.isDataAvailable=function(){return this.model.listingDescriptions()._fetched
};
k.prototype.changeTab=function(n){var m;
n.preventDefault();
m=$(n.currentTarget).attr("aria-controls");
if(m==="tab-pane-last"){this.app.selectedDescriptionLanguageIndex=null
}else{this.app.selectedDescriptionLanguageIndex=parseInt(_(m.split("-")).last(),10)
}return this.render()
};
k.prototype.handleTabScrolling=function(){var z,r,o,D,q,v,C,F,s,B,p,A,y,w,n,E,x,m,G,u;
E=this.$(".multiple-description-tabs li").not(".tab-pager");
s=this.$(".prev-tab-page");
C=this.$(".next-tab-page");
y=this.app.selectedDescriptionLanguageIndex===null?E.length-1:this.app.selectedDescriptionLanguageIndex;
A=E.get(y);
q=function(){var K,J,L,I,H;
J=[s.clone(),C.clone()];
H=[];
for(L=0,I=J.length;
L<I;
L++){K=J[L];
H.push(K.css({display:""}))
}return H
};
z=function(H){return H.children("a").position().top
};
B=$(E.first());
p=z(B);
for(m=0,G=E.length;
m<G;
m++){n=E[m];
n=$(n);
x=z(n);
if(Math.abs(x-p)>2){u=q(),F=u[0],v=u[1];
r=B;
v.insertBefore(r);
while(z(v)>p){r=r.prev();
if(r.length===0){break
}v.insertBefore(r)
}F.insertAfter(v);
F.css("clear","left");
v.children("a").attr({"aria-controls":F.next().children("a").attr("aria-controls")});
F.children("a").attr({"aria-controls":v.prev().children("a").attr("aria-controls")})
}p=x;
B=n
}D=this.$(".multiple-description-tabs li");
o=D.map(function(I,H){return z($(H))
});
w=z($(A));
return D.each(function(I,H){if(Math.abs(o[I]-w)>2){return $(H).remove()
}})
};
k.prototype.addFirstLanguage=function(m){if(m!=null){m.preventDefault()
}this.app.selectedDescriptionLanguageIndex=null;
return this.render()
};
k.prototype.selectLanguage=function(n){var m;
m=$(n.currentTarget).val();
if(m!==null){this.selectedLocaleForNewDescription=m;
return this.render()
}};
k.prototype.addNewLanguage=function(m){if(this.selectedLocaleForNewDescription==null){return
}this.model.listingDescriptions().create({locale:this.selectedLocaleForNewDescription});
this.app.selectedDescriptionLanguageIndex=this.model.listingDescriptions().size()-1;
this.selectedLocaleForNewDescription=null;
return this.render()
};
k.prototype.cancelAddLanguage=function(m){m.preventDefault();
this.app.selectedDescriptionLanguageIndex=0;
return this.render()
};
k.prototype.showDeleteConfirmationModal=function(q){var n,p,m,o;
if(q!=null){q.preventDefault()
}m=this.selectedListingDescriptionOrNull().get("locale");
p={languageName:this.languageNameFromLocale(m)};
n=$(JST["manage_listing/delete_description_confirmation"](p));
n.on("click",".js-delete-description-confirm",(function(r){return function(s){s.preventDefault();
o.close();
return r.removeCurrentLanguage()
}
})(this));
o=new h.Modal(n);
return o.open()
};
k.prototype.removeCurrentLanguage=function(o){var n,m;
m=this.model.listingDescriptions();
n=m.at(this.app.selectedDescriptionLanguageIndex);
n.destroy();
m.remove(n);
this.app.selectedDescriptionLanguageIndex=Math.max(0,this.app.selectedDescriptionLanguageIndex-1);
this.render();
return $(window).scrollTop(0)
};
k.prototype.descriptionTipRenderData=function(){var m,o,n,p;
o=this.selectedListingDescriptionOrNull();
m=this.descriptionTipData.destination;
p=this.descriptionTipData.requiredAttributes;
n=this.showTabs()?this.descriptionTipData.phraseKeyWithLanguage:this.descriptionTipData.phraseKey;
return{descriptionTipPhrase:t(n,{language:this.selectedLanguageNameOrNull()}),descriptionTipDestination:"/manage-listing/"+(this.model.get("id"))+"/"+m,showDescriptionTip:this.model.get("has_ever_been_available")&&o&&_.isEmpty(_.pick(o.attributes,p))}
};
return k
})(j)
},{"./page_view.coffee":79,o2:"o2"}],54:[function(d,g,b){var a,f,c={}.hasOwnProperty,h=function(m,k){for(var j in k){if(c.call(k,j)){m[j]=k[j]
}}function l(){this.constructor=m
}l.prototype=k.prototype;
m.prototype=new l();
m.__super__=k.prototype;
return m
};
a=d("./description_view.coffee");
g.exports=f=(function(k){h(j,k);
function j(){return j.__super__.constructor.apply(this,arguments)
}j.prototype.template="manage_listing/details";
j.prototype.tracking_name="details";
j.prototype.descriptionTipData={destination:"overview",phraseKey:"ml.details.write_an_overview_too",phraseKeyWithLanguage:"ml.details.write_an_overview_in_this_language_too",requiredAttributes:["name","summary"]};
return j
})(a)
},{"./description_view.coffee":53}],55:[function(c,g,a){var f,d,j,b={}.hasOwnProperty,h=function(n,l){for(var k in l){if(b.call(l,k)){n[k]=l[k]
}}function m(){this.constructor=n
}m.prototype=l.prototype;
n.prototype=new m();
n.__super__=l.prototype;
return n
};
j=c("o2");
f=c("./base_view.coffee");
g.exports=d=(function(l){h(k,l);
function k(){return k.__super__.constructor.apply(this,arguments)
}k.prototype.template="manage_listing/disaster_alert";
k.prototype.el="#js-disaster-alert";
k.prototype.events={"click #js-opt-out":"launchOptOutConfirmationModal"};
k.prototype.initialize=function(){moment.lang(I18n.locale());
this.app=this.options.app;
this.disaster=this.options.disaster.disaster;
this.startDate=moment(new Date(this.disaster.start_time)).format("LL");
this.endDate=moment(new Date(this.disaster.stop_time)).format("LL");
this.localizedZeroPrice=I18n.priceString(0);
return k.__super__.initialize.apply(this,arguments)
};
k.prototype.bindings=function(){this.listenTo(this.model,"saving:success:street",this.checkIfInDisasterZone);
return this.listenTo(this.app,"disaster:not_in_disaster_zone",this.cleanup)
};
k.prototype.getRenderData=function(){return _.extend(k.__super__.getRenderData.apply(this,arguments),{linked_disaster_name:"<a href='/disaster/"+this.disaster.canonical_name+"'>"+this.disaster.name+"</a>",disaster:{name:this.disaster.name,canonicalName:this.disaster.canonical_name,regionName:this.disaster.affected_region_name,price:this.localizedZeroPrice,startDate:this.startDate,endDate:this.endDate}})
};
k.prototype.checkIfInDisasterZone=function(){return $.ajax({url:"/disaster/lookup",type:"get",data:{id:this.model.get("id"),lat:this.model.get("lat"),lng:this.model.get("lng")},dataType:"json",success:(function(m){return function(n){if(!n.disaster){return m.app.trigger("disaster:not_in_disaster_zone")
}}
})(this)})
};
k.prototype.launchOptOutConfirmationModal=function(p){var o,n,m;
p.preventDefault();
n={price:this.localizedZeroPrice,startDate:this.startDate,endDate:this.endDate,name:this.disaster.name};
m=JST["manage_listing/disaster_opt_out_confirmation_modal"](n);
this.confirmationModal=new j.Modal(m);
o=this.confirmationModal.$element;
this.confirmationModal.open();
return o.find("#js-opt-out-confirmation").on("click",(function(q){return function(r){r.preventDefault();
o.find(".modal-content").addClass("loading");
return q.optOut()
}
})(this))
};
k.prototype.optOut=function(){var m;
m=Airbnb.Api.getUrl("/v1/listings/"+(this.model.get("id"))+"/opt_out_of_zero_price_for_disaster");
return $.ajax({url:m,type:"post",success:(function(n){return function(o){Flash.success(I18n.t("ml.disaster.no longer offering your listing",{name:n.disaster.name}));
n.app.trigger("disaster:opted_out");
n.cleanup();
return n.confirmationModal.close()
}
})(this),error:(function(n){return function(o){Flash.error(I18n.t("ml.Sorry, something went wrong."));
return n.confirmationModal.close()
}
})(this)})
};
return k
})(f)
},{"./base_view.coffee":34,o2:"o2"}],56:[function(d,f,a){var c,h,b={}.hasOwnProperty,g=function(m,k){for(var j in k){if(b.call(k,j)){m[j]=k[j]
}}function l(){this.constructor=m
}l.prototype=k.prototype;
m.prototype=new l();
m.__super__=k.prototype;
return m
};
h=d("o2");
f.exports=c=(function(k){g(j,k);
function j(){return j.__super__.constructor.apply(this,arguments)
}j.prototype.template="manage_listing/generic_modal";
j.prototype.className="modal";
j.prototype.attributes={role:"dialog"};
j.prototype.events=function(){return{"click .panel-footer .btn":"clickButton"}
};
j.prototype.getRenderData=function(){return this.formatOptions(this.options)
};
j.prototype.formatOptions=function(l){l=_.clone(l);
_.defaults(l,{close:true,title:null,body:"",buttons:[]});
l.buttons=l.buttons.map(function(m){return _.defaults({},m,{close:false,primary:false,type:"button",text:"",href:null})
});
return l
};
j.prototype.postRender=function(){return this.modal=new h.Modal(this.el).open()
};
j.prototype.clickButton=function(m){var l;
l=this.$(".panel-footer .btn").index(m.currentTarget);
this.trigger("click:button",m);
return this.trigger("click:button_"+l,m)
};
return j
})(AIR.Views.BaseView)
},{o2:"o2"}],57:[function(d,g,a){var f,j,c=function(k,l){return function(){return k.apply(l,arguments)
}
},b={}.hasOwnProperty,h=function(n,l){for(var k in l){if(b.call(l,k)){n[k]=l[k]
}}function m(){this.constructor=n
}m.prototype=l.prototype;
n.prototype=new m();
n.__super__=l.prototype;
return n
};
f=d("./base_view.coffee");
g.exports=j=(function(k){h(l,k);
function l(){this.updateVisibility=c(this.updateVisibility,this);
this.showLetter=c(this.showLetter,this);
return l.__super__.constructor.apply(this,arguments)
}l.prototype.initialize=function(){this.app=this.options.app;
this.router=this.options.router;
this.model=this.app.listing;
this.render();
this.bindings();
return this.updateVisibility()
};
l.prototype.modalId="#ginger-snap-modal";
l.prototype.template="manage_listing/ginger_biscuit";
l.prototype.bindings=function(){this.listenTo(this.model,"change:steps_remaining",this.updateVisibility);
this.listenTo(this.model,"change:has_availability",this.updateVisibility);
$(window).on("resize scroll",this.updateVisibility);
return $(window).on("resize scroll",this.positionModal)
};
l.prototype.events={"click .ginger-snap":"showLetter"};
l.prototype.getRenderData=function(){return this.model.get("user")
};
l.prototype.hostingId=function(){return this.model.get("id")
};
l.prototype.positionModal=function(){var m,n;
if(this.modalIsOpen){m=$(this.modalId);
n=$(window).height()-(m.height()+229);
return m.css({top:n})
}};
l.prototype.showLetter=function(){var m;
m=this.hostingId();
modal(this.modalId).open((function(n){return function(){n.modalIsOpen=true;
n.positionModal();
return n.app.trigger("tracking:gingersnap","button_click",m)
}
})(this));
return $(this.modalId).one("modalClose",(function(n){return function(){n.app.trigger("tracking:gingersnap","note_click_close",m);
return n.modalIsOpen=false
}
})(this))
};
l.prototype.viewIsTallEnough=function(){return $(window).height()>690
};
l.prototype.trackView=function(){if(!this.gingersnapTracked){this.app.trigger("tracking:gingersnap","button_displayed",this.hostingId());
return this.gingersnapTracked=true
}};
l.prototype.show=function(){this.$el.find(".ginger-snap").fadeIn(222);
return this.trackView()
};
l.prototype.hide=function(){this.$el.find(".ginger-snap").stop().fadeOut(222);
if(this.modalIsOpen){return modal.close()
}};
l.prototype.updateVisibility=function(){var n,m;
m=this.model.get("steps_remaining")===0;
n=this.model.get("has_ever_been_available")||this.model.get("has_availability");
if(m&&!n){if(this.viewIsTallEnough()){return this.show()
}else{return this.hide()
}}else{return this.hide()
}};
return l
})(f)
},{"./base_view.coffee":34}],58:[function(f,g,b){var a,j,d=function(k,l){return function(){return k.apply(l,arguments)
}
},c={}.hasOwnProperty,h=function(n,l){for(var k in l){if(c.call(l,k)){n[k]=l[k]
}}function m(){this.constructor=n
}m.prototype=l.prototype;
n.prototype=new m();
n.__super__=l.prototype;
return n
};
j=f("./page_view.coffee");
g.exports=a=(function(l){h(k,l);
function k(){this.initSections=d(this.initSections,this);
return k.__super__.constructor.apply(this,arguments)
}k.prototype.template="manage_listing/guest_experiences";
k.prototype.tracking_name="experience";
k.prototype.initialize=function(){this.app=this.options.app;
this.model=this.options.model;
this.experienceData=this.options.experienceData;
return k.__super__.initialize.apply(this,arguments)
};
k.prototype.events={"click .js-experience-option":"clickSection","click .js-save-guest-experience":"saveExperience"};
k.prototype.postInitialize=function(){this.app.trigger("section:impressions",{mainSection:"overview",subSection:"guest_experiences",experiment:"experience_classification"});
return k.__super__.postInitialize.apply(this,arguments)
};
k.prototype.postRender=function(){this.initSections();
return k.__super__.postRender.apply(this,arguments)
};
k.prototype.getRenderData=function(){return _.extend(this.model.data(),{shared:this.experienceData.shared,experiences:this.experienceData.experiences})
};
k.prototype.initSections=function(){var n,m;
m=this.model.get("experiences_offered");
if(m&&m!=="none"){n=this.$("#"+m+"-experience");
return this.selectSection(n)
}};
k.prototype.isSelected=function(m){return m.hasClass("selected")
};
k.prototype.clickSection=function(n){var m;
m=$(n.currentTarget);
if(!this.isSelected(m)){if(m.hasClass("open")){return this.contractSection(m)
}else{return this.expandSection(m)
}}};
k.prototype.expandSection=function(o){var m,n;
m=o.find(".js-experience-details");
n=m.css("height","auto").height();
m.height("1").stop().animate({height:n});
o.addClass("open");
o.find(".icon-caret-left").removeClass("icon-caret-left").addClass("icon-caret-down");
return this.app.trigger("experience:view",{section:o.find("button").attr("name")})
};
k.prototype.contractSection=function(m){m.removeClass("open");
m.find(".js-experience-details").stop().animate({height:0});
return m.find(".icon-caret-down").removeClass("icon-caret-down").addClass("icon-caret-left")
};
k.prototype.selectSection=function(m){m.addClass("selected");
m.siblings().remove();
m.find(".js-experience-details").css("height","auto");
m.find(".js-experience-icon").addClass("icon-pink");
m.find(".icon-caret-down, .icon-caret-left").hide();
return this.toggleButton(m.find("button"))
};
k.prototype.toggleButton=function(m){m.removeClass("btn-primary");
m.html(t("guest_experience.buttontext2"));
return m.blur()
};
k.prototype.saveExperience=function(o){var n,m;
m=$(o.currentTarget);
n=m.closest(".js-experience-option");
this.trackClick(m);
if(this.isSelected(n)){this.saveModelForEvent(o,this.model,"experiences_offered","none");
return this.render()
}else{this.selectSection(n);
this.saveModelForEvent(o,this.model,"experiences_offered",m.attr("name"));
return $("html, body").stop().animate({scrollTop:n.offset().top-90})
}};
k.prototype.trackClick=function(m){var o,n;
n=m.attr("name");
o=m.hasClass("btn-primary")?"select_click":"change_click";
return this.app.trigger("experience:click",{clickType:o,section:n})
};
return k
})(j)
},{"./page_view.coffee":79}],59:[function(d,f,b){var a,h,c={}.hasOwnProperty,g=function(m,k){for(var j in k){if(c.call(k,j)){m[j]=k[j]
}}function l(){this.constructor=m
}l.prototype=k.prototype;
m.prototype=new l();
m.__super__=k.prototype;
return m
};
h=d("./page_view.coffee");
f.exports=a=(function(k){g(j,k);
function j(){return j.__super__.constructor.apply(this,arguments)
}j.prototype.template="manage_listing/guidebook/guidebook_entry";
j.prototype.tagName="li";
j.prototype.events={"click .js-edit-recommendation":"editRecommendation","click .display-recommendation":"panToRec"};
j.prototype.initialize=function(){this.app=this.options.app;
this.collection=this.options.collection;
return this.recommendation=this.options.recommendation
};
j.prototype.getRenderData=function(){return _.extend(this.recommendation.attributes,{category_long:this.recommendation.categoryLong(),formatted_address:this.recommendation.street_address(),icon:this.recommendation.iconClass()})
};
j.prototype.toggleDisplay=function(){return this.$(".display-recommendation").toggleClass("hide")
};
j.prototype.panToRec=function(){return this.app.trigger("guidebook:recommendation_click",this.recommendation)
};
j.prototype.editRecommendation=function(){return this.recommendation.trigger("guidebook:show_edit_form",this.recommendation)
};
return j
})(h)
},{"./page_view.coffee":79}],60:[function(d,b,g){var h,k,a,l,c,j={}.hasOwnProperty,f=function(q,o){for(var n in o){if(j.call(o,n)){q[n]=o[n]
}}function p(){this.constructor=q
}p.prototype=o.prototype;
q.prototype=new p();
q.__super__=o.prototype;
return q
},m=[].indexOf||function(p){for(var o=0,n=this.length;
o<n;
o++){if(o in this&&this[o]===p){return o
}}return -1
};
c=d("o2");
k=c.Modal;
a=d("./page_view.coffee");
l=d("../models/place_recommendation.coffee");
b.exports=h=(function(p){var n;
f(o,p);
function o(){return o.__super__.constructor.apply(this,arguments)
}n=200;
o.prototype.template="manage_listing/guidebook/guidebook_edit_form";
o.prototype.events={"click .js-delete-recommendation":"launchDeleteModal","click .js-save-recommendation":"saveRecommendation","click .js-cancel-edit":"cancelEdit","change #place-category":"categoryChanged","keyup #place-reason":"updateReasonCharCount","keydown #place-reason":"updateReasonCharCount"};
o.prototype.initialize=function(){this.app=this.options.app;
this.listing=this.app.listing;
this.collection=this.options.collection;
this.categories=this.collection.categories;
this.existingRecommendation=this.options.recommendation;
return this.newPlace=this.options.newPlace
};
o.prototype.postRender=function(){this.updateReasonCharCount();
this.setCategoryAndIcon();
return this.$("#place-reason").attr("maxlength",n)
};
o.prototype.getRenderData=function(){if(this.existingRecommendation){return _.extend(this.existingRecommendation.attributes,{categories:this.categories})
}else{return _.extend(this.newPlace,{categories:this.categories,newRec:true})
}};
o.prototype.isValid=function(q,s){var r;
r=true;
if(!(q&&s)){r=false
}if((s!=null?s.length:void 0)>n){r=false
}return r
};
o.prototype.saveRecommendation=function(){var u,q,r,s;
this.hideErrors();
q=this.$("#place-name").val();
s=this.$("#place-reason").val();
if(!this.isValid(q,s)){return this.showErrors(q,s)
}else{u={name:q,reason:s,category:this.$("#place-category").val(),reference:this.$("#place-reference").val()};
if(this.existingRecommendation){this.existingRecommendation.set(u);
this.existingRecommendation.save()
}else{r=new l({},{listing:this.listing});
r.save(u,{success:(function(v){return function(){return v.collection.add(r)
}
})(this)});
this.app.trigger("guidebook:new_entry",{category:u.category,action:"save_click"})
}return this.cancelEdit()
}};
o.prototype.launchDeleteModal=function(s){var r,q;
s.preventDefault();
q=JST["manage_listing/guidebook/delete_recommendation_confirmation"]();
r=$(q);
r.on("click",".js-delete-recommendation-confirm",(function(u){return function(v){return u.deleteRecommendation()
}
})(this));
this.deletePhotoModal=new k(r);
return this.deletePhotoModal.open()
};
o.prototype.deleteRecommendation=function(){this.collection.remove(this.existingRecommendation);
this.existingRecommendation.destroy();
this.deletePhotoModal.close();
return this.deletePhotoModal.$element.remove()
};
o.prototype.cancelEdit=function(q){if(q!=null){q.preventDefault()
}if(this.existingRecommendation){return this.existingRecommendation.trigger("guidebook:display_recommendation",this.existingRecommendation)
}else{return this.trigger("guidebook:display_search_bar")
}};
o.prototype.setCategoryAndIcon=function(){var q;
if(this.existingRecommendation){q=this.existingRecommendation.get("category")
}else{if(this.newPlace.types!=null){q=this.newPlace.types[0]
}if(m.call(_.map(this.categories,function(r){return r.name
}),q)<0){q="other"
}}this.$("#place-category").val(q);
return this.updateIcon(q)
};
o.prototype.categoryChanged=function(q){var r;
r=$(q.currentTarget).val();
return this.updateIcon(r)
};
o.prototype.updateIcon=function(s){var r,q;
r=this.$("#js-category-icon");
q=this.app.get("guidebook_data").category_to_icon[s];
r.removeClass();
return r.addClass("pull-left icon category-icon text-center icon-"+q)
};
o.prototype.showErrors=function(q,r){if(!q){this.$("#place-name").addClass("invalid");
this.$(".name-error").removeClass("hide")
}if(!r){this.$("#place-reason").addClass("invalid");
this.$(".reason-error").removeClass("hide")
}if(r.length>n){return this.$(".reason-error-too-long").removeClass("hide")
}};
o.prototype.hideErrors=function(){this.$("#place-name").removeClass("invalid");
this.$("#place-reason").removeClass("invalid");
this.$(".name-error").addClass("hide");
this.$(".reason-error").addClass("hide");
return this.$(".reason-error-too-long").addClass("hide")
};
o.prototype.updateReasonCharCount=function(){var q,s,r;
s=this.$("#place-reason");
if(this.recommendation){r=this.existingRecommendation.countLeft("reason")
}else{r=n-s.val().length
}q=this.$("#js-reason-count span");
if(r<=5){q.addClass("ml-error");
if(r<0){s.addClass("invalid")
}}else{q.removeClass("ml-error");
s.removeClass("invalid")
}return q.html(r)
};
return o
})(a)
},{"../models/place_recommendation.coffee":21,"./page_view.coffee":79,o2:"o2"}],61:[function(c,b,f){var g,k,a,h=function(l,m){return function(){return l.apply(m,arguments)
}
},j={}.hasOwnProperty,d=function(o,m){for(var l in m){if(j.call(m,l)){o[l]=m[l]
}}function n(){this.constructor=o
}n.prototype=m.prototype;
o.prototype=new n();
o.__super__=m.prototype;
return o
};
g=c("./guidebook_edit_recommendation_view.coffee");
a=c("./page_view.coffee");
b.exports=k=(function(m){d(l,m);
function l(){this.openNewRecommendationForm=h(this.openNewRecommendationForm,this);
this.drawPin=h(this.drawPin,this);
return l.__super__.constructor.apply(this,arguments)
}l.prototype.MAP_ZOOM=14;
l.prototype.template="manage_listing/guidebook/guidebook_map";
l.prototype.events={"focus #search":"trackInputFocus"};
l.prototype.initialize=function(){this.app=this.options.app;
this.model=this.options.model;
this.collection=this.options.collection;
this.categories=this.collection.categories;
this.collection.bind("change",this.updatePins,this);
this.collection.bind("add",this.updatePins,this);
this.collection.bind("remove",this.updatePins,this);
google.maps.visualRefresh=true;
return l.__super__.initialize.apply(this,arguments)
};
l.prototype.postRender=function(){this.initializeMap();
this.initAutocomplete();
return this.updatePins()
};
l.prototype.bindings=function(){return this.listenTo(this.app,"guidebook:recommendation_click",this.panToRec)
};
l.prototype.initializeMap=function(){var p,o,n;
p=new google.maps.LatLng(this.model.get("lat"),this.model.get("lng"));
n={center:p,zoom:this.MAP_ZOOM,zoomControl:true,scrollwheel:false,disableDefaultUI:true};
this.map=new google.maps.Map(this.$(".map-canvas")[0],n);
this.pins=[];
this.infoWindow=new google.maps.InfoWindow({maxWidth:200});
o="manage_listing/address/map-pin-set.png";
this.homeMarker=new google.maps.Marker({position:p,map:this.map,icon:new google.maps.MarkerImage(ImagePaths[o],new google.maps.Size(50,55),new google.maps.Point(0,0))});
google.maps.event.addListener(this.map,"click",(function(q){return function(){return q.infoWindow.close()
}
})(this));
return google.maps.event.addListener(this.map,"drag",(function(q){return function(){return q.infoWindow.close()
}
})(this))
};
l.prototype.updatePins=function(){this.erasePins();
return this.collection.each(this.drawPin)
};
l.prototype.erasePins=function(){_.each(this.pins,function(n){return n.setMap(null)
});
return this.pins=[]
};
l.prototype.drawPin=function(p){var o,n;
o=ImagePaths["manage_listing/gb-pins-sprite.png"];
n=new google.maps.Marker({map:this.map,position:new google.maps.LatLng(p.get("place").lat,p.get("place").lng),rec:p,icon:new google.maps.MarkerImage(o,new google.maps.Size(30,36),new google.maps.Point(0,p.verticalOffset()))});
google.maps.event.addListener(n,"click",(function(q){return function(){var r;
r=q.getTooltipContentFor(p);
q.infoWindow.setContent(r);
return q.infoWindow.open(q.map,n)
}
})(this));
return this.pins.push(n)
};
l.prototype.getTooltipContentFor=function(q){var n,p,o;
o=q.get("name");
n=q.formatted_address();
p=q.iconClass();
return"<div class='map-tooltip'> <strong>"+o+"</strong> <p>"+n+"</p> </div>"
};
l.prototype.panToRec=function(p){var n,o;
if((o=this.tempPin)!=null){o.setVisible(false)
}n=_.findWhere(this.pins,{rec:p});
this.map.panTo(n.getPosition());
this.infoWindow.setContent(this.getTooltipContentFor(p));
return this.infoWindow.open(this.map,n)
};
l.prototype.initAutocomplete=function(){var n;
n=this.$("#search")[0];
this.placeService=new google.maps.places.PlacesService(this.map);
this.autocomplete=new google.maps.places.Autocomplete(n,{types:["geocode","establishment"]});
this.autocomplete.bindTo("bounds",this.map);
return google.maps.event.addListener(this.autocomplete,"place_changed",(function(o){return function(){var p;
p=o.autocomplete.getPlace();
if(_.keys(p).length===1&&p.name){return o.lookupLocation(p.name)
}else{return o.openNewRecommendationForm(p)
}}
})(this))
};
l.prototype.openNewRecommendationForm=function(n){if(this.editView){this.editView.newPlace=n;
this.editView.render()
}else{this.editView=new g({app:this.app,collection:this.collection,newPlace:n});
this.$el.find(".search-panel").append(this.editView.render().el);
this.listenTo(this.editView,"guidebook:display_search_bar",this.toggleEditForm)
}if(n.geometry.viewport){this.map.fitBounds(n.geometry.viewport)
}else{this.map.setCenter(n.geometry.location);
this.map.setZoom(17)
}this.toggleEditForm();
return this.createTempPinFor(n)
};
l.prototype.toggleEditForm=function(){var o,n;
this.$("#search").toggleClass("hide").val("");
this.$(".icon-search").toggleClass("hide");
this.editView.$el.find(".edit-entry").toggleClass("hide");
if((o=this.tempPin)!=null){o.setVisible(false)
}return(n=this.infoWindow)!=null?n.close():void 0
};
l.prototype.createTempPinFor=function(n){if(this.tempPin){this.tempPin.setVisible(false)
}else{this.tempPin=new google.maps.Marker({map:this.map,icon:new google.maps.MarkerImage(ImagePaths["manage_listing/gb-pins-sprite.png"],new google.maps.Size(30,36),new google.maps.Point(0,360))})
}this.tempPin.setPosition(n.geometry.location);
this.tempPin.setVisible(true);
this.infoWindow.setContent(("<strong>"+n.name+"</strong>")+("<p>"+n.formatted_address+"</p>"));
return this.infoWindow.open(this.map,this.tempPin)
};
l.prototype.lookupLocation=function(o){var n;
n={name:o,bounds:this.map.getBounds()};
return this.placeService.search(n,(function(p){return function(r,q){var s;
if(q===google.maps.places.PlacesServiceStatus.OK){s={reference:r[0].reference};
return p.placeService.getDetails(s,function(u,v){if(v===google.maps.places.PlacesServiceStatus.OK){return p.openNewRecommendationForm(u)
}else{return p.displayLocationError()
}})
}else{return p.displayLocationError()
}}
})(this))
};
l.prototype.displayLocationError=function(){};
l.prototype.trackInputFocus=function(){return this.app.trigger("guidebook:new_entry",{action:"add_location_field_click"})
};
return l
})(a)
},{"./guidebook_edit_recommendation_view.coffee":60,"./page_view.coffee":79}],62:[function(d,c,g){var a,j,h,b,k=function(m,n){return function(){return m.apply(n,arguments)
}
},l={}.hasOwnProperty,f=function(p,n){for(var m in n){if(l.call(n,m)){p[m]=n[m]
}}function o(){this.constructor=p
}o.prototype=n.prototype;
p.prototype=new o();
p.__super__=n.prototype;
return p
};
a=d("./guidebook_display_recommendation_view.coffee");
j=d("./guidebook_edit_recommendation_view.coffee");
b=d("./page_view.coffee");
c.exports=h=(function(n){f(m,n);
function m(){this.displayRecommendation=k(this.displayRecommendation,this);
this.editRecommendation=k(this.editRecommendation,this);
this.render=k(this.render,this);
return m.__super__.constructor.apply(this,arguments)
}m.prototype.tagName="li";
m.prototype.className="guidebook-entry";
m.prototype.initialize=function(){this.app=this.options.app;
this.collection=this.options.collection;
this.recommendation=this.options.recommendation;
this.listenTo(this.recommendation,"guidebook:show_edit_form",this.editRecommendation);
this.listenTo(this.recommendation,"guidebook:display_recommendation",this.displayRecommendation);
this.displayView=new a({app:this.app,collection:this.collection,recommendation:this.recommendation,el:this.$el});
return this.editView=new j({app:this.app,collection:this.collection,recommendation:this.recommendation,el:this.$el})
};
m.prototype.render=function(){m.__super__.render.apply(this,arguments);
return this.displayView.render()
};
m.prototype.editRecommendation=function(){this.editView.render();
return this.$el.addClass("dark")
};
m.prototype.displayRecommendation=function(){this.displayView.render();
return this.$el.removeClass("dark")
};
return m
})(b)
},{"./guidebook_display_recommendation_view.coffee":59,"./guidebook_edit_recommendation_view.coffee":60,"./page_view.coffee":79}],63:[function(c,b,f){var g,k,a,h=function(l,m){return function(){return l.apply(m,arguments)
}
},j={}.hasOwnProperty,d=function(o,m){for(var l in m){if(j.call(m,l)){o[l]=m[l]
}}function n(){this.constructor=o
}n.prototype=m.prototype;
o.prototype=new n();
o.__super__=m.prototype;
return o
};
g=c("./guidebook_recommendation_view.coffee");
a=c("./page_view.coffee");
b.exports=k=(function(l){d(m,l);
function m(){this.updateRec=h(this.updateRec,this);
this.removeRec=h(this.removeRec,this);
this.addRec=h(this.addRec,this);
this.checkForZeroRecs=h(this.checkForZeroRecs,this);
return m.__super__.constructor.apply(this,arguments)
}m.prototype.initialize=function(){this.app=this.options.app;
this.collection=this.options.collection;
this.subviews=[];
this.collection.each(this.addRec);
this.checkForZeroRecs();
this.collection.bind("add",this.addRec);
this.collection.bind("remove",this.removeRec);
return this.collection.bind("sync",this.updateRec)
};
m.prototype.checkForZeroRecs=function(){var n;
n=this.$(".instructions");
if(this.collection.length===0){return n.removeClass("hide")
}else{return n.addClass("hide")
}};
m.prototype.addRec=function(o){var n;
n=new g({app:this.app,collection:this.collection,recommendation:o});
this.subviews.push(n);
this.$el.prepend(n.render().el);
return this.checkForZeroRecs()
};
m.prototype.removeRec=function(o){var n;
n=(_.select(this.subviews,function(p){return p.recommendation===o
}))[0];
this.subviews=_.without(this.subviews,n);
n.cleanup();
return this.checkForZeroRecs()
};
m.prototype.updateRec=function(o){var n;
n=(_.select(this.subviews,function(p){return p.recommendation===o
}))[0];
return n.render()
};
return m
})(a)
},{"./guidebook_recommendation_view.coffee":62,"./page_view.coffee":79}],64:[function(c,b,f){var h,k,j,a,g={}.hasOwnProperty,d=function(o,m){for(var l in m){if(g.call(m,l)){o[l]=m[l]
}}function n(){this.constructor=o
}n.prototype=m.prototype;
o.prototype=new n();
o.__super__=m.prototype;
return o
};
h=c("./guidebook_map_view.coffee");
k=c("./guidebook_recommendations_view.coffee");
a=c("./page_view.coffee");
b.exports=j=(function(l){d(m,l);
function m(){return m.__super__.constructor.apply(this,arguments)
}m.prototype.template="manage_listing/guidebook/guidebook";
m.prototype.bodyClassName="wide-content-section";
m.prototype.initialize=function(){this.app=this.options.app;
this.model=this.options.model;
this.subviews=[];
return m.__super__.initialize.apply(this,arguments)
};
m.prototype.events={"hover #guidebook-container":"showTooltipSticky"};
m.prototype.bindings=function(){m.__super__.bindings.apply(this,arguments);
return this.listenTo(this,"render:dom_inserted",this.onDomInserted)
};
m.prototype.onDomInserted=function(){Airbnb.Utils.loadGooglePlaces();
Airbnb.Utils.withGooglePlaces((function(n){return function(){return n.initMap()
}
})(this));
this.initRecommendationList();
return this.app.trigger("guidebook:impression",{numEntries:this.model.placeRecommendations().length})
};
m.prototype.initMap=function(){this.mapView=new h({app:this.app,model:this.model,el:"#map-container",collection:this.model.placeRecommendations()});
this.subviews.push(this.mapView);
return this.mapView.render()
};
m.prototype.initRecommendationList=function(){this.recommendationsView=new k({app:this.app,el:"#recommendations",collection:this.model.placeRecommendations()});
return this.subviews.push(this.recommendationsView)
};
return m
})(a)
},{"./guidebook_map_view.coffee":61,"./guidebook_recommendations_view.coffee":63,"./page_view.coffee":79}],65:[function(c,g,a){var f,d,b={}.hasOwnProperty,h=function(m,k){for(var j in k){if(b.call(k,j)){m[j]=k[j]
}}function l(){this.constructor=m
}l.prototype=k.prototype;
m.prototype=new l();
m.__super__=k.prototype;
return m
};
f=c("./base_view.coffee");
g.exports=d=(function(k){h(j,k);
function j(){return j.__super__.constructor.apply(this,arguments)
}j.prototype.initialize=function(){this.app=this.options.app;
return this.bindings()
};
j.prototype.template="manage_listing/header";
j.prototype.bindings=function(){this.model.listingDescriptions().on("change",this.onTitleChange,this);
return this.model.on("change:has_availability",this.updatePreviewButton,this)
};
j.prototype.events=function(){return{"click .open-preview":"openPreview","click .all-listings":"setUiRef"}
};
j.prototype.postRender=function(){var l;
j.__super__.postRender.apply(this,arguments);
l=this.model.listingDescriptions().at(0);
if(l){this.updateTitle(l.get("name"))
}return this.stickyHeader()
};
j.prototype.setUiRef=function(){return Airbnb.Tracking.setUiRef("all_listings_btn")
};
j.prototype.onTitleChange=function(l){if(this.model.listingDescriptions().at(0)===l){return this.updateTitle(l.get("name"))
}};
j.prototype.updateTitle=function(l){l||(l=I18n.t("ml.description.hosting_placeholder_name",{room_type:this.model.get("room_type"),city:this.model.get("city")}));
return this.$("#listing-name").text(l)
};
j.prototype.updatePreviewButton=function(){var l;
l=this.model.get("has_availability")?I18n.t("ml.view"):I18n.t("ml.preview");
return this.$(".preview-string").text(l)
};
j.prototype.stickyHeader=function(){var n,o,m,l;
l=this.$el.offset().top-14;
o=$("#js-manage-listing-nav");
m=o.outerWidth();
n=$("body");
return $(window).scroll((function(p){return function(){var q;
q=$(window).scrollTop();
if(l<q){p.$el.css({position:"fixed",top:0});
n.css({paddingTop:l});
o.css({position:"fixed",top:l});
return o.addClass("fixed")
}else{p.$el.css({position:""});
n.css({paddingTop:0});
o.css({position:"absolute",top:0});
return o.removeClass("fixed")
}}
})(this))
};
j.prototype.openPreview=function(l){l.preventDefault();
return window.open($(l.currentTarget).attr("href"))
};
return j
})(f)
},{"./base_view.coffee":34}],66:[function(d,f,b){var a,h,c={}.hasOwnProperty,g=function(m,k){for(var j in k){if(c.call(k,j)){m[j]=k[j]
}}function l(){this.constructor=m
}l.prototype=k.prototype;
m.prototype=new l();
m.__super__=k.prototype;
return m
};
h=d("./page_view.coffee");
f.exports=a=(function(k){g(j,k);
function j(){return j.__super__.constructor.apply(this,arguments)
}j.prototype.bindings=function(){return this.listenTo(this.model,"change:instant_booking_visibility",this.toggleLightningBolt)
};
j.prototype.events={"change select":"handleSelectChange"};
j.prototype.initWhoCanBookSelect=function(){return this.createSelect({modelAttrKey:"instant_booking_visibility",selectId:"ib-who-can-book-select",content:this.app.get("instant_book_options"),disabled:!this.model.isInstantBookEnabled()})
};
j.prototype.initLeadTimeSelect=function(){return this.createSelect({modelAttrKey:"instant_book_lead_time_hours",selectId:"ib-advanced-notice-select",content:this.app.get("instant_book_advance_notice"),disabled:!this.model.isInstantBookEnabled()})
};
j.prototype.trackIBEnabledFTUEImpression=function(o,n,m,l){return Airbnb.Tracking.logEvent({event_name:"instant_book",event_data:{experiment:"update_calendar_tooltip",event_action:o,hosting_id:this.model.id,treatment:n,has_closed:m,calendar_visible:l}})
};
j.prototype.toggleLightningBolt=function(){return this.$(".ib-icon-bolt").toggleClass("icon-beach",this.model.isInstantBookEnabled())
};
return j
})(h)
},{"./page_view.coffee":79}],67:[function(f,h,b){var g,a,d=function(k,l){return function(){return k.apply(l,arguments)
}
},c={}.hasOwnProperty,j=function(n,l){for(var k in l){if(c.call(l,k)){n[k]=l[k]
}}function m(){this.constructor=n
}m.prototype=l.prototype;
n.prototype=new m();
n.__super__=l.prototype;
return n
};
g=f("./base_view.coffee");
h.exports=a=(function(m){var l;
j(k,m);
function k(){this.positionOverlay=d(this.positionOverlay,this);
this.cleanup=d(this.cleanup,this);
return k.__super__.constructor.apply(this,arguments)
}l=27;
k.prototype.template="manage_listing/instant_book_enabled_ftue";
k.prototype.events={"click .panel-close":"close"};
k.prototype.close=function(n){if(n){n.preventDefault();
this.app.trigger("tracking:ib_enabled_ftue","close_click")
}this.model.set("has_closed_instant_book_enabled_ftue",true);
this.model.save();
this.$el.fadeOut("fast",this.cleanup);
return Airbnb.Tracking.logEvent({event_name:"instant_book",event_data:{experiment:"update_calendar_tooltip",event_action:"close",hosting_id:this.model.id}})
};
k.prototype.cleanup=function(){$(window).off("scroll",this.positionOverlay);
$(".nav-sections").off("scroll",this.positionOverlay);
this.$navItem.removeClass("nav-item-highlighted");
return k.__super__.cleanup.apply(this,arguments)
};
k.prototype.className="instant-book-enabled-ftue";
k.prototype.bindings=function(){$(window).on("scroll",this.positionOverlay);
return $(".nav-sections").on("scroll",this.positionOverlay)
};
k.prototype.initialize=function(){this.app=this.options.app;
return this.$navItem=this.options.$navItem
};
k.prototype.postRender=function(){$("body").append(this.$el);
this.bindings();
this.positionOverlay();
return this.$navItem.addClass("nav-item-highlighted")
};
k.prototype.positionOverlay=function(){var n;
if(this._headerHeight==null){this._headerHeight=$("#header").height()
}n=this.$navItem.offset().top-$(window).scrollTop()-l;
if(n<this._headerHeight){this.close();
return
}if(this.left==null){this.left=this.$navItem.width()+this.$navItem.offset().left
}return this.$el.css({top:n,left:this.left})
};
return k
})(g)
},{"./base_view.coffee":34}],68:[function(d,g,a){var f,j,c=function(k,l){return function(){return k.apply(l,arguments)
}
},b={}.hasOwnProperty,h=function(n,l){for(var k in l){if(b.call(l,k)){n[k]=l[k]
}}function m(){this.constructor=n
}m.prototype=l.prototype;
n.prototype=new m();
n.__super__=l.prototype;
return n
};
f=d("./base_view.coffee");
g.exports=j=(function(l){var k;
h(m,l);
function m(){this.positionOverlay=c(this.positionOverlay,this);
this.handleRouteChange=c(this.handleRouteChange,this);
this.cleanup=c(this.cleanup,this);
return m.__super__.constructor.apply(this,arguments)
}k=27;
m.prototype.template="manage_listing/instant_book_ftue";
m.prototype.trackingName="instant_book_ftue";
m.prototype.className="instant-book-ftue";
m.prototype.events=function(){return{"click #js-try-instant-book":"navigateToInstantBook","click .panel-close":"close"}
};
m.prototype.close=function(n){if(n){n.preventDefault();
this.app.trigger("tracking:ib_ftue","close_click",this.trackingName,this.currentTabIndex)
}this.model.set("has_closed_instant_book_ftue",true);
this.model.save();
return this.$el.fadeOut("fast",this.cleanup)
};
m.prototype.cleanup=function(){$(window).off("scroll",this.positionOverlay);
$(".nav-sections").off("scroll",this.positionOverlay);
this.$navItem.removeClass("nav-item-highlighted");
return m.__super__.cleanup.apply(this,arguments)
};
m.prototype.navigateToInstantBook=function(){this.close();
this.app.trigger("tracking:ib_ftue","try_instant_book_click",this.trackingName,this.currentTabIndex);
return this.app.router.navigateToInstantBook()
};
m.prototype.bindings=function(){$(window).on("scroll",this.positionOverlay);
return $(".nav-sections").on("scroll",this.positionOverlay)
};
m.prototype.initialize=function(){this.app=this.options.app;
this.model=this.options.model;
this.$navItem=this.options.$navItem;
return this.app.router.bind("all",this.handleRouteChange)
};
m.prototype.handleRouteChange=function(n){if(n==="route:instant-book"){return this.navigateToInstantBook()
}};
m.prototype.logImpressionInAirEvents=function(){return Airbnb.Tracking.logEvent({event_name:"instant_book",event_data:{action:"impression",experiment:"ib_ftue_modal",hosting_id:this.model.get("id"),modal_version:this.trackingName}})
};
m.prototype.postRender=function(){$("body").append(this.$el);
this.bindings();
this.positionOverlay();
this.app.trigger("tracking:ib_ftue","impression",this.trackingName,this.currentTabIndex);
return this.logImpressionInAirEvents()
};
m.prototype.shouldRender=function(){return !this.model.get("instant_book_enabled")&&this.model.get("instant_book_eligible")&&!this.model.get("has_closed_instant_book_ftue")&&this.model.get("steps_remaining")===0&&this.$navItem.is(":visible")
};
m.prototype.positionOverlay=function(){var o,n;
if(this._headerHeight==null){this._headerHeight=$("#header").height()
}n=this.$navItem.offset().top-$(window).scrollTop()-k;
if(n<this._headerHeight){this.close();
return
}o=this.$navItem.width()+this.$navItem.offset().left;
this.$el.css({top:n,left:o});
return this.$navItem.addClass("nav-item-highlighted")
};
return m
})(f)
},{"./base_view.coffee":34}],69:[function(f,h,c){var a,b,g,d={}.hasOwnProperty,j=function(n,l){for(var k in l){if(d.call(l,k)){n[k]=l[k]
}}function m(){this.constructor=n
}m.prototype=l.prototype;
n.prototype=new m();
n.__super__=l.prototype;
return n
};
a=f("./instant_book_base_view.coffee");
b=f("./instant_book_enabled_ftue_view.coffee");
h.exports=g=(function(l){j(k,l);
function k(){return k.__super__.constructor.apply(this,arguments)
}k.prototype.template="manage_listing/instant_book_v3";
k.prototype.initialize=function(){this.app=this.options.app;
this.model=this.options.model;
return k.__super__.initialize.apply(this,arguments)
};
k.prototype.bindings=function(){this.listenTo(this.model,"change:instant_booking_visibility",this.toggleFormEditability);
this.listenTo(this.model,"change:instant_book_lead_time_hours",this.toggleHourlyLeadTime);
return k.__super__.bindings.apply(this,arguments)
};
k.prototype.events=_.extend({"change #ib-enabled":"onInstantBookChange","blur [name=instant_book_welcome_message]":"handleBlur","keyup [name=instant_book_welcome_message]":"updateWelcomeMessageCharCount","hover .js-tooltip-trigger":"showTooltipSticky"},a.prototype.events);
k.prototype.shouldShowHourlyLeadTimeSelect=function(){return this.model.get("instant_book_lead_time_hours")<24&&this.app.get("hourly_ib_lead_time_enabled")
};
k.prototype.updateWelcomeMessageCharCount=function(p){var o,m,n;
o=this.$(".js-welcome-msg-char-count");
m=this.$('[name="instant_book_welcome_message"]').val().length;
n=Math.max(this.app.get("welcome_message_char_limit")-m,0);
o.html(I18n.t("ml.instant_book.char count",{smart_count:n}));
return o.toggleClass("ml-error",n===0)
};
k.prototype.getRenderData=function(){return _.extend(k.__super__.getRenderData.apply(this,arguments),{instantBookEnabled:this.model.isInstantBookEnabled(),maxLimit:this.app.get("welcome_message_char_limit")})
};
k.prototype.initHourlyLeadTimeSelect=function(){return this.createSelect({modelAttrKey:"instant_book_lead_time_hours",selectId:"ib-lead-time-hourly-select",content:this.app.get("localized_options_for_ib_hourly_lead_time"),disabled:!this.model.isInstantBookEnabled()})
};
k.prototype.postInitialize=function(){this.app.trigger("section:impressions",this.options.trackingData);
return k.__super__.postInitialize.apply(this,arguments)
};
k.prototype.initSelects=function(){this.initWhoCanBookSelect();
this.initLeadTimeSelect();
return this.initHourlyLeadTimeSelect()
};
k.prototype.toggleUiElements=function(){this.toggleHourlyLeadTime();
this.toggleLightningBolt();
this.toggleFormEditability();
return this.toggleWelcomeMessageUi()
};
k.prototype.postRender=function(){this.trackSectionImpression();
this.initSelects();
this.toggleUiElements();
return this.updateWelcomeMessageCharCount()
};
k.prototype.trackSectionImpression=function(){return Airbnb.Tracking.logEvent({event_name:"manage_listing",event_data:{page:"instant_book",section:"",operation:"impression",id_listing:this.model.get("id")}})
};
k.prototype.onInstantBookChange=function(q){var p,o,r,m,n,s;
if($(q.currentTarget).is(":checked")){this.model.set("instant_booking_visibility",this.$("#ib-who-can-book-select select").val());
p=$(".nav-calendar");
s=this.app.get("instant_book_enabled_nav_experiment");
n=this.model.get("has_closed_instant_book_enabled_ftue");
o=p.is(":visible");
r=s&&!n&&o;
if(r){this.renderIBEnabledFTUE(p)
}m=r?"impression":"nonimpression";
this.trackIBEnabledFTUEImpression(m,s,n,o)
}else{this.model.set("instant_booking_visibility",this.app.get("instant_book_off_string"))
}this.toggleFormEditability();
return this.saveModelForEvent(q,this.model,"instant_booking_visibility",this.model.get("instant_booking_visibility"))
};
k.prototype.toggleWelcomeMessageUi=function(){var m;
m=this.model.isInstantBookEnabled()||this.model.get("instant_book_welcome_message");
return this.$("#js-welcome-msg").toggleClass("hide",!m)
};
k.prototype.toggleHourlyLeadTime=function(){var m;
m=this.$("#js-hourly-lead-time");
this.setCurrentSelectionOnSelect(m,"instant_book_lead_time_hours");
return m.toggleClass("hide",!this.shouldShowHourlyLeadTimeSelect())
};
k.prototype.toggleFormEditability=function(){var m;
m=this.model.isInstantBookEnabled();
this.toggleWelcomeMessageUi();
this.$("textarea, select").prop("disabled",!m);
this.$(".js-ib-controls").toggleClass("ib-controls-disabled",!m);
if(m){$(".instant-book-ftue").hide();
return this.$(".panel-quote").addClass("panel-light").removeClass("panel-dark")
}else{return this.$(".panel-quote").removeClass("panel-light").addClass("panel-dark")
}};
k.prototype.renderIBEnabledFTUE=function(n){var m;
m=new b({app:this.app,model:this.model,$navItem:n});
return m.render()
};
return k
})(a)
},{"./instant_book_base_view.coffee":66,"./instant_book_enabled_ftue_view.coffee":67}],70:[function(c,a,f){var g,k,j,b,h={}.hasOwnProperty,d=function(o,m){for(var l in m){if(h.call(m,l)){o[l]=m[l]
}}function n(){this.constructor=o
}n.prototype=m.prototype;
o.prototype=new n();
o.__super__=m.prototype;
return o
};
b=c("o2");
j=b.Modal;
g=c("./base_view.coffee");
a.exports=k=(function(m){d(l,m);
function l(){return l.__super__.constructor.apply(this,arguments)
}l.prototype.template="manage_listing/your_space_is_listed_modal";
l.prototype.initialize=function(){this.app=this.options.app;
this.model=this.options.model;
this.router=this.options.router;
this.saveAvailability();
return l.__super__.initialize.apply(this,arguments)
};
l.prototype.saveAvailability=function(){var n;
this.model.set("has_availability",true);
return n=this.model.save({},{success:(function(o){return function(){return o.openModal()
}
})(this),error:(function(o){return function(){var p;
p=JSON.parse(n.responseText).error;
if(n.status===422&&p==="verification_required"){return o.router.navigateToVerify(o.model.id)
}else{return o.model.trigger("saving:error",{key:p})
}}
})(this)})
};
l.prototype.openModal=function(){var o,n;
n=this.getHtml();
o=new j(n,{sticky:true});
o.on("close",(function(p){return function(){return p.closeModal()
}
})(this));
o.open();
return this.app.trigger("impression",{getTrackingKey:function(){return"post_list_success_modal"
}})
};
l.prototype.closeModal=function(){this.cleanup();
this.app.trigger("list_space_modal_closed");
return this.router.navigateToBestRoute()
};
return l
})(g)
},{"./base_view.coffee":34,o2:"o2"}],71:[function(c,d,a){var g,j,h,b={}.hasOwnProperty,f=function(n,l){for(var k in l){if(b.call(l,k)){n[k]=l[k]
}}function m(){this.constructor=n
}m.prototype=l.prototype;
n.prototype=new m();
n.__super__=l.prototype;
return n
};
g=c("./delete_listing_view.coffee");
h=c("./page_view.coffee");
d.exports=j=(function(k){f(l,k);
function l(){return l.__super__.constructor.apply(this,arguments)
}l.prototype.initialize=function(){this.app=this.options.app;
this.subviews=[];
this.on("render:dom_inserted",this.onDOMInserted,this);
return l.__super__.initialize.apply(this,arguments)
};
l.prototype.template="manage_listing/listing";
l.prototype.modal_template="manage_listing/delete_listing_modal";
l.prototype.tracking_name="listing";
l.prototype.events={"hover [data-tooltip-element]":"showTooltipSticky","change select":"clickSelectOption","blur textarea":"handleBlur","click #js-delete-listing-link":"openDeleteListingModal","change input[name=visibility]":"updateVisibility","click #facebook-connect":"fbConnect"};
l.prototype.updateVisibility=function(n){var m;
m=$(n.currentTarget).attr("value");
return this.saveModelForEvent(n,this.model,"visibility",m)
};
l.prototype.clickSelectOption=function(o){var n,m;
n=$(o.currentTarget).closest("select");
m=n.attr("name");
if(m==="room_type_category"){if(n.val()!=="entire_home"){this.model.set("bedrooms",1)
}}if(m==="beds"){this.model.set("bed_type_category","real_bed")
}this.handleSelectChange(o);
if(m==="room_type_category"||m==="beds"){return this.render()
}};
l.prototype.onDOMInserted=function(){return this.app.trigger("render:dom_inserted:listing_view")
};
l.facebookSave=function(){return ManageListing.app.listing.save({facebook_connect:ManageListing.app.getFBCookie()})
};
l.prototype.fbConnect=Airbnb.Utils.fbButtonClickHandlerFactory("manage listing: visibility",l.facebookSave);
l.prototype.getRenderData=function(){var m;
m=l.__super__.getRenderData.apply(this,arguments);
if(_.has(m.listing,"visibility")){_.extend(m.listing,{visibleToSocialConnections:m.listing.visibility==="social_connections",visibleToExperiencedGuests:m.listing.visibility==="experienced_guests",visibleToWorld:m.listing.visibility==="world",facebookConnected:m.listing.extra_user_info.facebook_connected})
}m.displayFlags={showBedType:m.listing.beds<=1};
return m
};
l.prototype.shouldShowBedrooms=function(){return this.model.get("room_type_category")==="entire_home"
};
l.prototype.postRender=function(){l.__super__.postRender.apply(this,arguments);
return this.initSelects()
};
l.prototype.initSelects=function(){var o,n,m;
o=I18n.t("ml.Select... call to action for select lists");
m=this.shouldShowBedrooms();
n=[{modelAttrKey:"beds",selectId:"beds-select",content:this.app.get("beds"),placeHolder:o},{modelAttrKey:"person_capacity",selectId:"person-capacity-select",content:this.app.get("person_capacity")},{modelAttrKey:"room_type_category",selectId:"room-type-select",content:this.app.get("room_types")},{modelAttrKey:"property_type_id",selectId:"property-type-select",content:this.app.get("property_types")},{modelAttrKey:"bathrooms",selectId:"bathrooms-select",content:this.app.get("bathrooms"),placeHolder:o},{modelAttrKey:"bedrooms",selectId:"bedrooms-select",content:this.app.get("bedrooms"),placeHolder:o,disabled:!m,tooltip:!m?I18n.t("ml.error.bedrooms_only_entire_home_apt"):void 0,tooltip_position:"right"},{modelAttrKey:"bed_type_category",selectId:"bedtype-select",content:this.app.get("bed_types"),placeHolder:o},{modelAttrKey:"cancel_policy",selectId:"cancellation-policy-select",content:this.app.get("cancellation_options")},{modelAttrKey:"check_in_time",selectId:"check-in-time-select",content:this.app.get("checkinout_time_options")},{modelAttrKey:"check_out_time",selectId:"check-out-time-select",content:this.app.get("checkinout_time_options")}];
return _.each(n,(function(p){return function(q){return p.createSelect(q)
}
})(this))
};
l.prototype.openDeleteListingModal=function(m){m.preventDefault();
this.deleteListingView=new g({el:this.$("#delete-listing-container"),model:this.model,app:this.app}).render();
return this.subviews.push(this.deleteListingView)
};
return l
})(h)
},{"./delete_listing_view.coffee":52,"./page_view.coffee":79}],72:[function(d,g,a){var j,c,f,b={}.hasOwnProperty,h=function(n,l){for(var k in l){if(b.call(l,k)){n[k]=l[k]
}}function m(){this.constructor=n
}m.prototype=l.prototype;
n.prototype=new m();
n.__super__=l.prototype;
return n
};
c=d("./address_view.coffee");
j=d("./address_helper_view.coffee");
g.exports=f=(function(l){h(k,l);
function k(){return k.__super__.constructor.apply(this,arguments)
}k.prototype.template="manage_listing/location";
k.prototype.tracking_name="location";
k.prototype.events={"click .js-edit-address-link":"initAddressView","click #js-add-address":"initAddressView","hover #js-location-container":"showTooltipSticky","blur textarea":"handleBlur","click .ny-legal-trigger":"showNYLegal"};
k.prototype.initialize=function(){this.app=this.options.app;
if(this.options.confirmAddressFlow){this.listenTo(this.app,"address:complete",(function(m){return function(){return m.app.router.navigate(m.options.returnFragment,{trigger:true})
}
})(this))
}return k.__super__.initialize.apply(this,arguments)
};
k.prototype.bindings=function(){return this.listenTo(this.app,"address:complete",this.rerender)
};
k.prototype.rerender=function(){this.addressView.cleanup();
return this.render()
};
k.prototype.getRenderData=function(){var o,v,u,x,r,s,w,y,n,q,m,p;
u=this.model.get("is_location_exact")||this.model.get("user_defined_location");
x=this.model.get("state")==="NY";
v=this.model.get("has_ever_been_available");
r=this.model.get("jurisdiction_names");
p=this.app.get("location_view_apple_turnover")&&!(x&&!v);
if(u){y="371";
s="275";
m="205";
n="205";
w=this.getStaticMapUrl({size:""+y+"x"+s});
q=this.getStaticMapUrl({size:""+m+"x"+n});
o={hasSavedAddress:u,mainMapUrl:w,mainMapWidth:y,mainMapHeight:s,publicMapWidth:m,publicMapHeight:n,publicMapUrl:q,address:this.getSavedAddress(),addressPresenter:this.app.get("address_data"),isHostingStateNY:x,shouldDisplayAppleTurnover:p,jurisdiction_names:r}
}else{o={hasSavedAddress:u,isHostingStateNY:x,shouldDisplayAppleTurnover:p,jurisdiction_names:r}
}return _.extend(this.model.data(),o,{addressViewSubtitleContent:JST["manage_listing/address_view_subtitle"]()})
};
k.prototype.initAddressView=function(m){if(m){m.preventDefault()
}return this.addressView=new c({el:this.$("#address-flow-view"),model:this.model,app:this.app}).render()
};
k.prototype.showNYLegal=function(m){m.preventDefault();
return this.app.router.showNYLegal()
};
return k
})(j)
},{"./address_helper_view.coffee":27,"./address_view.coffee":30}],73:[function(d,f,a){var h,j,c=function(k,l){return function(){return k.apply(l,arguments)
}
},b={}.hasOwnProperty,g=function(n,l){for(var k in l){if(b.call(l,k)){n[k]=l[k]
}}function m(){this.constructor=n
}m.prototype=l.prototype;
n.prototype=new m();
n.__super__=l.prototype;
return n
};
h=d("./address_helper_view.coffee");
f.exports=j=(function(k){g(l,k);
function l(){this.saveLatLng=c(this.saveLatLng,this);
this.endDrag=c(this.endDrag,this);
this.startDrag=c(this.startDrag,this);
return l.__super__.constructor.apply(this,arguments)
}l.prototype.MAP_ZOOM=16;
l.prototype.template="manage_listing/address/map_pin";
l.prototype.events={"click .js-zoom-out":"zoomOut","click .js-zoom-in":"zoomIn","click .js-next-btn":"saveLatLng","click .js-adjust-pin-location":"clickAdjustPinBtn"};
l.prototype.initialize=function(){this.app=this.options.app;
this.fields=this.options.address;
return l.__super__.initialize.apply(this,arguments)
};
l.prototype.getRenderData=function(){var m,n;
m=JST["manage_listing/address/secondary_choice_button"]({"class":"js-adjust-pin-location js-secondary-btn",btnText:I18n.t("ml.details.verify_address.Adjust Pin Location")});
n={address:this.getSavedAddress(),addressPresenter:this.app.get("address_data"),altChoiceBtnHtml:m};
return _.extend(this.model.data,n)
};
l.prototype.postRender=function(){if(this.options.pane==="pin_location"){this.pane="pin_location"
}else{if(this.model.get("is_location_exact")||this.options.pane==="verify_location"){amplify.store("tempAddress",null);
this.pane="verify_location"
}}this.$el.data("pane",this.pane);
this.updatePaneContent();
this.initTooltip(I18n.t("ml.details.pin_on_map.tooltip_text"));
this.updateNavButtonState();
this.trackPaneImpressions();
return this.buildAndDisplayMap()
};
l.prototype.updateNavButtonState=function(m){if(m==null){m=false
}if(!m){if(this.pane==="verify_location"){m=true
}}return this.app.trigger("address_nav:update_btn",m)
};
l.prototype.updatePaneContent=function(){var m,o,n,p;
m=this.$(".js-address-nav-heading");
if(this.pane==="pin_location"){p=I18n.t("ml.details.pin_on_map.title");
n=I18n.t("ml.details.pin_on_map.subtitle");
o=I18n.t("shared.Finish");
this.$(".js-secondary-btn").addClass("hide")
}else{p=I18n.t("ml.details.verify_address.title");
n=I18n.t("ml.details.verify_address.subtitle");
o=I18n.t("ml.details.verify_address.btn_text")
}m.find("span").text(p);
m.find("small").html(n);
return this.$(".js-next-btn").text(o)
};
l.prototype.clickCancelBtn=function(m){if(m){m.preventDefault()
}this.model.set("is_location_exact",true);
this.options.pane="verify_location";
return this.render()
};
l.prototype.clickAdjustPinBtn=function(m){if(m){m.preventDefault()
}this.model.set("is_location_exact",false);
this.options.pane="pin_location";
return this.render()
};
l.prototype.buildAndDisplayMap=function(){Airbnb.Utils.loadGooglePlaces();
return Airbnb.Utils.withGooglePlaces((function(m){return function(){m.initializeMap();
m.updatePinStyle();
return m.showOverlay()
}
})(this))
};
l.prototype.zoomOut=function(){var m;
m=Math.max(this.map.getZoom()-1,1);
this.map.setZoom(m);
return this.app.trigger("tracking:zoom_out",m)
};
l.prototype.zoomIn=function(){var m;
m=this.map.getZoom()+1;
this.map.setZoom(m);
return this.app.trigger("tracking:zoom_in",m)
};
l.prototype.initializeMap=function(){var n,m;
if(this.pane==="pin_location"){n=true;
this.$(".js-map-zoom-controls").removeClass("hide")
}else{n=false;
this.$(".js-map-zoom-controls").addClass("hide")
}m={zoom:this.MAP_ZOOM,draggable:n,scrollwheel:false,center:new google.maps.LatLng(this.model.get("lat"),this.model.get("lng")),mapTypeId:google.maps.MapTypeId.ROADMAP,disableDefaultUI:true};
this.map=new google.maps.Map(this.$(".map-canvas")[0],m);
window.map=this.map;
google.maps.event.addListener(this.map,"dragstart",this.startDrag);
google.maps.event.addListener(this.map,"dragend",this.endDrag);
return this.showOverlay()
};
l.prototype.startDrag=function(){this.app.trigger("map:start_drag","map:start_drag");
this.updateNavButtonState(true);
this.$(".map-pin").removeClass("unset").removeClass("set").addClass("moving");
return this.hideOverlay()
};
l.prototype.endDrag=function(){this.app.trigger("map:end_drag","map:end_drag");
this.app.trigger("tracking:map_drag");
this.$(".map-pin").removeClass("moving").addClass("unset");
return this.showOverlay()
};
l.prototype.showOverlay=function(){if(!this.overlay){this.initializeOverlay()
}return this.overlay.setMap(this.map)
};
l.prototype.hideOverlay=function(){return this.overlay.setMap(null)
};
l.prototype.initializeOverlay=function(){this.overlay=new google.maps.OverlayView();
this.overlay.onAdd=(function(m){return function(){m.overlayDiv=document.createElement("div");
m.overlayDiv.className="map-spotlight";
return m.overlay.getPanes().overlayImage.appendChild(m.overlayDiv)
}
})(this);
this.overlay.draw=(function(m){return function(){var p,q,o,n;
o=m.overlay.getProjection();
p=m.map.getBounds();
n=o.fromLatLngToDivPixel(p.getSouthWest());
q=o.fromLatLngToDivPixel(p.getNorthEast());
m.overlayDiv.style.left=n.x+"px";
m.overlayDiv.style.top=q.y+"px";
m.overlayDiv.style.width=(q.x-n.x)+"px";
return m.overlayDiv.style.height=(n.y-q.y)+"px"
}
})(this);
return this.overlay.onRemove=(function(m){return function(){return m.$(m.overlayDiv).remove()
}
})(this)
};
l.prototype.saveLatLng=function(o){var n,m;
if(o){o.preventDefault()
}if(!$(o.currentTarget).hasClass("disabled")){n=$("#js-address-container").find(".panel").first();
n.addClass("loading");
if(this.map){m=this.map.getCenter();
this.model.set(_.extend({},this.fields,{lat:m.lat(),lng:m.lng(),user_defined_location:true}));
this.map.setZoom(this.MAP_ZOOM)
}return this.model.save({},{success:(function(p){return function(){var q;
q=p.model.get("errors");
if(_.isEmpty(q)){return p.app.trigger("address:complete")
}else{n.removeClass("loading");
return p.$("#error_invalid_pin").removeClass("hide")
}}
})(this)})
}};
l.prototype.updatePinStyle=function(){if(this.pane==="verify_location"){return this.$(".map-pin").removeClass("unset").addClass("set")
}else{return this.$(".map-pin").removeClass("set").addClass("unset")
}};
return l
})(h)
},{"./address_helper_view.coffee":27}],74:[function(d,g,b){var f,a,c={}.hasOwnProperty,h=function(m,k){for(var j in k){if(c.call(k,j)){m[j]=k[j]
}}function l(){this.constructor=m
}l.prototype=k.prototype;
m.prototype=new l();
m.__super__=k.prototype;
return m
};
f=d("./base_view.coffee");
g.exports=a=(function(k){h(j,k);
function j(){return j.__super__.constructor.apply(this,arguments)
}j.prototype.template="manage_listing/min_max_nights_view";
j.prototype.events={"change #min-nights":"saveMinStay","change #max-nights":"saveMaxStay"};
j.prototype.initialize=function(){j.__super__.initialize.apply(this,arguments);
this.app=this.options.app;
this.model=this.options.model;
return this.render()
};
j.prototype.saveMinMaxStay=function(o,m){var l,n;
n=$(o.currentTarget).val().trim();
l=null;
if(n){n=parseInt(n,10)
}if(_.isNaN(n)){l=I18n.t("ml.minmax.must_be_number")
}else{if(_.isNumber(n)){if(!this.isValidInterval(n,m)){l=I18n.t("ml.minmax.min > max")
}else{if(n===0){l=I18n.t("ml.minmax.min_zero")
}}}}if(!l){this.saveModelForEvent(o,this.model,""+m+"_nights_input_value",n)
}return this.addErrorToMinMax(l)
};
j.prototype.saveMinStay=function(l){return this.saveMinMaxStay(l,"min")
};
j.prototype.saveMaxStay=function(l){return this.saveMinMaxStay(l,"max")
};
j.prototype.isValidInterval=function(m,l){if(l==="min"){return m<this.model.get("max_nights")
}else{return m>this.model.get("min_nights")
}};
j.prototype.addErrorToMinMax=function(l){if(l){return this.$("#min-max-error").show().text(l)
}else{return this.rerender()
}};
j.prototype.rerender=function(){this.render();
return this.delegateEvents()
};
return j
})(f)
},{"./base_view.coffee":34}],75:[function(b,a,d){var f,g,j,k,l,h={}.hasOwnProperty,c=function(p,n){for(var m in n){if(h.call(n,m)){p[m]=n[m]
}}function o(){this.constructor=p
}o.prototype=n.prototype;
p.prototype=new o();
p.__super__=n.prototype;
return p
};
j=b("./instant_book_ftue_view.coffee");
g=b("./ginger_biscuit_view.coffee");
l=b("./publish_button_view.coffee");
f=b("./base_view.coffee");
a.exports=k=(function(n){var o,p;
c(m,n);
function m(){return m.__super__.constructor.apply(this,arguments)
}m.prototype.template="manage_listing/navigation/nav_buttons";
o=200;
p=500;
m.prototype.initialize=function(){this.app=this.options.app;
this.router=this.options.router;
this.model=this.app.listing;
this.bindings();
this.iconsLoaded=false;
this.iconsWaitForModal=!this.model.get("has_ever_been_edited");
this.render();
this.model.updateListability();
this.initGingerBiscuit();
if(this.app.get("user_is_suspended")){this.showUserSuspended()
}else{this.initPublishButton();
this.initAvailabilityDropdown()
}return $(window).on("resize",(function(q){return function(){return q.adjustSideNav()
}
})(this))
};
m.prototype.postRender=function(){this.updateExperienceNavLink();
this.showDetailsIfRequired();
this.displayInstantBookFTUE();
this.updateInstantBookStatus();
this.model.updatePostListingRequirements();
return _.defer((function(q){return function(){return q.adjustSideNav()
}
})(this))
};
m.prototype.displayInstantBookFTUE=function(){var r,q;
r=this.$(".nav-instant-book");
q=new j({app:this.app,model:this.model,$navItem:r});
if(q.shouldRender()){return q.render()
}};
m.prototype.updateInstantBookStatus=function(){var q,r;
r=this.app.get("ib_adoption_onoffvisual_v1");
if(r){q=this.getInstantBookStatusIcon();
return q.toggleClass("hide",!this.model.isInstantBookEnabled())
}};
m.prototype.showDetailsIfRequired=function(){if(!this.model.get("has_ever_been_available")&&(this.app.userManuallyOpenedDetailsSection||this.app.get("has_details_been_edited"))){return $(".manage-listing-nav .nav-details").removeClass("post-listed")
}};
m.prototype.initIcons=function(s){var q,u,r;
if(this.iconsLoaded||this.iconsWaitForModal){return
}r=this.getIconsToAnimate();
this.$jsStepsRemaining=this.$(".js-steps-remaining");
q=0;
u=0;
if(s){q=500;
u=300;
this.$jsStepsRemaining.delay(q+r.length*u).queue((function(v){return function(){return v.doPulseAnimation()
}
})(this))
}r.each((function(v){return function(x,y){var w;
w=$(y);
return w.delay(q+x*u).queue(function(){if(s){w.addClass("transition")
}else{window.setTimeout(function(){return w.addClass("transition")
},u)
}return w.addClass("visible")
})
}
})(this));
return this.iconsLoaded=true
};
m.prototype.doPulseAnimation=function(){this.$jsStepsRemaining.addClass("pulse");
return window.setTimeout((function(q){return function(){return q.$jsStepsRemaining.removeClass("pulse")
}
})(this),p)
};
m.prototype.getIconsToAnimate=function(){if(!this.model.get("has_availability")){return this.$(".pre-listed:not(.complete) .js-new-section-icon, .pre-listed.complete .nav-icon-checked")
}else{return this.$(".js-new-section-icon:not(.not-post-listed):not(.post-list-completed)")
}};
m.prototype.toggleAddIconVisibility=function(q,r){return q.toggleClass("visible",r)
};
m.prototype.toggleCheckedIconVisibility=function(q,r){return q.toggleClass("visible",r)
};
m.prototype.getAddIcon=function(q){return this.$(".nav-"+q+" .js-new-section-icon")
};
m.prototype.getCheckedIcon=function(q){return this.$(".nav-"+q+" .nav-icon-checked")
};
m.prototype.getInstantBookStatusIcon=function(){return this.$(".nav-instant-book .icon-bolt")
};
m.prototype.setCompleteIcon=function(r,u){var s,q;
if(this.iconsLoaded){s=this.getAddIcon(r);
q=this.getCheckedIcon(r);
if(u){this.toggleAddIconVisibility(s,false);
return window.setTimeout((function(v){return function(){v.$(".nav-"+r).addClass("complete");
return v.toggleCheckedIconVisibility(q,true)
}
})(this),o)
}else{this.toggleCheckedIconVisibility(q,false);
return window.setTimeout((function(v){return function(){v.$(".nav-"+r).removeClass("complete");
return v.toggleAddIconVisibility(s,true)
}
})(this),o)
}}else{return this.$(".nav-"+r).toggleClass("complete",u)
}};
m.prototype.getRenderData=function(){var q,r;
r=this.app.get("nav_items").settings;
if(!this.app.get("show_cleaning")){r=_.reject(r,(function(s){return function(u){return u["class"]==="cleaning"
}
})(this))
}q=this.app.get("nav_items").basics;
if(!this.model.get("instant_book_eligible")){q=_.reject(q,(function(s){return function(u){return u["class"]==="instant-book"
}
})(this))
}return{basics:this.navItems(q),description:this.navItems(this.app.get("nav_items").description),settings:this.navItems(r),cleaning:this.navItems(this.app.get("nav_items").cleaning),show_cleaning:this.app.get("show_cleaning")}
};
m.prototype.navItems=function(q){var r,s;
if(!q){return{visible:false,nav_items:[]}
}r=_.uniq(_.pluck(q,"visible"));
s=r.length===1?r[0]:null;
return{visible:s,nav_items:q}
};
m.prototype.events={"click a":"handleClick"};
m.prototype.initIconsOnModalClose=function(){this.iconsLoaded=false;
this.iconsWaitForModal=false;
return this.initIcons(true)
};
m.prototype.handleListSpaceModalClosed=function(){this.initIconsOnModalClose();
this.removeComplete();
return this.surfaceAvailabilityDropdown()
};
m.prototype.updateExperienceNavLink=function(){if(!this.app.get("enable_guest_experiences")){return this.$(".nav-experience").remove()
}};
m.prototype.bindings=function(){this.listenTo(this.app.router,"all",this.updateNav);
this.listenTo(this.app,"listability",this.updateCompleteness);
this.listenTo(this.app,"complete_requirement",this.updateRequiredness);
this.listenTo(this.app,"loading",this.updateLoading);
this.listenTo(this.app,"welcome_modal_closed",this.initIconsOnModalClose);
this.listenTo(this.app,"list_space_modal_closed",this.handleListSpaceModalClosed);
this.listenTo(this.app,"userManuallyOpenedDetailsSection",this.showDetailsIfRequired);
return this.listenTo(this.model,"change:instant_booking_visibility",this.updateInstantBookStatus)
};
m.prototype.showUserSuspended=function(){var q;
q=JST["manage_listing/navigation/user_suspended"]();
return this.$("#user-suspended").html(q)
};
m.prototype.initGingerBiscuit=function(){return this.gingerSnap=new g({app:this.app,model:this.model,router:this.router,el:"#ginger-snap"})
};
m.prototype.initPublishButton=function(){return this.publishBtnView=new l({app:this.app,model:this.model,router:this.router,el:"#js-publish-button"})
};
m.prototype.initAvailabilityDropdown=function(){if(this._availability_dropdown==null){this._availability_dropdown=new AIR.Views.Shared.AvailabilityDropdown({el:"#availability-dropdown",hosting_id:this.model.get("id"),has_availability:this.model.get("has_availability"),has_ever_been_available:this.model.get("has_ever_been_available"),upwards:true})
}if(!this.app.get("user_is_suspended")){return this._availability_dropdown.render()
}};
m.prototype.removeComplete=function(){return this.$(".nav-item").removeClass("complete")
};
m.prototype.surfaceAvailabilityDropdown=function(){this._availability_dropdown.setAvailability(this.model.get("has_availability"),false);
if(!this.app.get("user_is_suspended")){return this._availability_dropdown.render()
}};
m.prototype.updateLoading=function(q){if(q.isCurrentlyLoading){return this.$(".nav-"+q.view).addClass("nav-item-loading")
}else{return this.$(".nav-"+q.view).removeClass("nav-item-loading")
}};
m.prototype.updateRequiredness=function(r,q){this.$(".nav-"+r+" .js-new-section-icon").toggleClass("post-list-completed",q);
return this.toggleAddIconVisibility(this.getAddIcon(r),!q)
};
m.prototype.updateCompleteness=function(r,q){var s;
s=q&&!this.model.get("has_ever_been_available");
return this.setCompleteIcon(r,s)
};
m.prototype.updateNav=function(){var q;
q=this.router.currentRoute;
this.$(".nav-item").removeClass("nav-active");
this.$(".nav-"+q).addClass("nav-active");
this.togglePublishActions();
return this.initIcons(false)
};
m.prototype.adjustSideNav=function(){var r,s,q;
r=$(".nav-sections");
if(r.length){s=$(".publish-actions");
if(this.airbnbHeader==null){this.airbnbHeader=$("#header").outerHeight()
}if(this.disasterAlert==null){this.disasterAlert=$("#js-disaster-alert").outerHeight()
}if(this.mlHeader==null){this.mlHeader=$(".manage-listing-header").outerHeight()
}if(this.publishActions==null){this.publishActions=s.outerHeight()
}if(this.mlFooter==null){this.mlFooter=$(".manage-listing-footer").outerHeight()
}q=window.innerHeight-Math.max(this.airbnbHeader-$(window).scrollTop(),0)-this.mlHeader-this.publishActions-this.mlFooter-this.disasterAlert;
s.css("bottom",this.mlFooter);
if(this.disasterAlert){s.css("bottom","+="+this.disasterAlert)
}r.css("height",q);
if(q<r[0].scrollHeight){return s.addClass("publish-actions-overflow")
}else{return s.removeClass("publish-actions-overflow")
}}};
m.prototype.handleClick=function(s){var q,r;
q=$(s.currentTarget);
if(!q.parent().hasClass("nav-active")){this.$el.find(".nav-active").removeClass("nav-active")
}r=s.currentTarget.getAttribute("href");
if(r.match(/reactivate/)){s.preventDefault();
return window.location.href=r
}else{this.model.set({has_ever_been_edited:true});
this.model.save();
return this.router.followClickIfShould(s)
}};
m.prototype.togglePublishActions=function(){if(this.router.currentRoute==="complete"){return this.$(".publish-actions").addClass("hide")
}else{return this.$(".publish-actions").removeClass("hide")
}};
return m
})(f)
},{"./base_view.coffee":34,"./ginger_biscuit_view.coffee":57,"./instant_book_ftue_view.coffee":68,"./publish_button_view.coffee":83}],76:[function(f,g,b){var a,j,d,c={}.hasOwnProperty,h=function(n,l){for(var k in l){if(c.call(l,k)){n[k]=l[k]
}}function m(){this.constructor=n
}m.prototype=l.prototype;
n.prototype=new m();
n.__super__=l.prototype;
return n
};
a=f("./cleaning_helper_view.coffee");
g.exports=j=(function(l){h(k,l);
function k(){return k.__super__.constructor.apply(this,arguments)
}k.prototype.template="manage_listing/cleaning/next_cleaning";
k.prototype.initialize=function(m){this.app=m.app;
this.upcoming=m.upcoming_reservations;
this.model=d(this.upcoming);
this.renderCallback=(function(n){return function(){return n.render()
}
})(this);
return _.each(this.upcoming,(function(n){return function(o){o.cleaning_jobs.on("sync",n.renderCallback);
o.cleaning_jobs.on("add",n.renderCallback);
return o.cleaning_jobs.on("remove",n.renderCallback)
}
})(this))
};
k.prototype.cleanup=function(){return _.each(this.upcoming,(function(m){return function(n){n.cleaning_jobs.off("sync",m.renderCallback);
n.cleaning_jobs.off("add",m.renderCallback);
return n.cleaning_jobs.off("remove",m.renderCallback)
}
})(this))
};
k.prototype.getRenderData=function(){var n,m;
n={nextCleaningJob:null,partner_info:this.app.get("cleaning_partner_info")};
if(this.model){if(this.model){m=this.model.data()
}if(this.model.hasDiscount()){m.show_discount=true;
m.discount_percent=this.model.discountPercent()
}if(m){m.linen_service=this.model.linenService();
m.laundry_service=this.model.laundryService()
}n.nextCleaningJob=m
}return n
};
return k
})(a);
d=function(k){var m,l,n;
n=_.find(k,function(o){return o.cleaning_jobs.length>0&&o.cleaning_jobs.find(function(p){return p.isPending()
})
});
if(n!=null){m=n.cleaning_jobs.find(function(o){return o.isCheckin()
});
l=n.cleaning_jobs.find(function(o){return o.isCheckout()
});
if(m&&m.isPending()){return m
}else{return l
}}else{return null
}}
},{"./cleaning_helper_view.coffee":43}],77:[function(d,a,g){var h,b,c,j=function(l,m){return function(){return l.apply(m,arguments)
}
},k={}.hasOwnProperty,f=function(o,m){for(var l in m){if(k.call(m,l)){o[l]=m[l]
}}function n(){this.constructor=o
}n.prototype=m.prototype;
o.prototype=new n();
o.__super__=m.prototype;
return o
};
c=d("o2");
h=d("./base_view.coffee");
a.exports=b=(function(m){f(l,m);
function l(){this.trackEvent=j(this.trackEvent,this);
return l.__super__.constructor.apply(this,arguments)
}l.prototype.template="manage_listing/ny_legal";
l.prototype.className="modal";
l.prototype.events={"click .okay-button":"clickOkay"};
l.prototype.postRender=function(){var n;
n=new c.Modal(this.$el,{sticky:true});
n.open();
return this.trackEvent("impression")
};
l.prototype.clickOkay=function(){this.model.set("has_agreed_to_legal_terms",true);
this.model.save();
return this.trackEvent("click_okay")
};
l.prototype.trackEvent=function(n){return Airbnb.Tracking.logEvent({event_name:"ny_legal",event_data:{event_action:n,hosting_id:this.model.id}})
};
return l
})(h)
},{"./base_view.coffee":34,o2:"o2"}],78:[function(d,g,b){var a,f,c={}.hasOwnProperty,h=function(m,k){for(var j in k){if(c.call(k,j)){m[j]=k[j]
}}function l(){this.constructor=m
}l.prototype=k.prototype;
m.prototype=new l();
m.__super__=k.prototype;
return m
};
a=d("./description_view.coffee");
g.exports=f=(function(k){h(j,k);
function j(){return j.__super__.constructor.apply(this,arguments)
}j.prototype.events=function(){return _.extend({},j.__super__.events.apply(this,arguments),{'keyup textarea[name="summary"]':"countCharacters",'keydown textarea[name="summary"]':"countCharacters",'change textarea[name="summary"]':"validatePresenceOfCharacters",'keyup input[name="name"]':"countCharacters",'keydown input[name="name"]':"countCharacters",'change input[name="name"]':"validatePresenceOfCharacters"})
};
j.prototype.template="manage_listing/overview";
j.prototype.tracking_name="overview";
j.prototype.getRenderData=function(){return _.extend({},j.__super__.getRenderData.apply(this,arguments),{hasDetailsSectionBeenEdited:this.model.hasDetailsSectionBeenEdited()})
};
j.prototype.preRender=function(){if(this._hasRendered){this.$("a[rel=tooltip]").trigger("mouseleave")
}return j.__super__.preRender.apply(this,arguments)
};
j.prototype.postRender=function(){j.__super__.postRender.apply(this,arguments);
if(this.$("#language-select").length===0&&this.$("[name='summary']").length>0&&this.$("[name='name']").length>0){this.updateCharCountUi("summary");
this.updateCharCountUi("name");
return this.setInputMaxLength()
}};
j.prototype.descriptionTipData={destination:"details",phraseKey:"ml.overview.write_a_detailed_description_too",phraseKeyWithLanguage:"ml.overview.write_a_detailed_description_in_this_language_too",requiredAttributes:["space","access","interaction","neighborhood_overview","transit","notes","house_rules"]};
j.prototype.setInputMaxLength=function(){var o,n,q,p,l,m;
n=this.selectedListingDescriptionOrNull();
p=n!=null?n.attributeLengths:void 0;
m=[];
for(o in p){q=p[o];
if((l=q.characters)!=null?l.max:void 0){m.push(this.$("[name='"+o+"']").attr("maxlength",q.characters.max))
}else{m.push(void 0)
}}return m
};
j.prototype.countCharacters=function(o){var n,m,l;
m=this.$(o.currentTarget);
n=m.attr("name");
l=this.selectedListingDescriptionOrNull();
l.set(n,m.val());
return this.updateCharCountUi(n)
};
j.prototype.updateCharCountUi=function(p){var n,o,m,l;
m=this.selectedListingDescriptionOrNull();
if(m==null){return
}o=m.countLeft(p);
n=(this[l="_$"+p+"Element"]!=null?this[l]:this[l]=this.$("[name='"+p+"']"));
if(n._errorMessage==null){n._errorMessage=n.siblings(".error-too-long")
}if(n._span==null){n._span=this.$("#js-"+p+"-count span")
}if(o<=5){n._span.addClass("ml-error");
if(o<0){n.addClass("invalid");
n._errorMessage.removeClass("hide")
}}else{n.removeClass("invalid");
n._errorMessage.addClass("hide");
n._span.removeClass("ml-error")
}return n._span.html(o)
};
j.prototype.validatePresenceOfCharacters=function(n){var m,l;
m=$(n.currentTarget);
l=m.siblings(".error-value-required");
if(m.val()===""){m.addClass("invalid");
return l.removeClass("hide")
}else{this.updateCharCountUi(m.attr("name"));
return l.addClass("hide")
}};
return j
})(a)
},{"./description_view.coffee":53}],79:[function(c,f,a){var d,j,h,b={}.hasOwnProperty,g=function(n,l){for(var k in l){if(b.call(l,k)){n[k]=l[k]
}}function m(){this.constructor=n
}m.prototype=l.prototype;
n.prototype=new m();
n.__super__=l.prototype;
return n
};
h=c("o2").Tooltip;
d=c("./base_view.coffee");
f.exports=j=(function(k){g(l,k);
function l(){return l.__super__.constructor.apply(this,arguments)
}l.prototype.postInitialize=function(){l.__super__.postInitialize.apply(this,arguments);
this.app=this.options.app;
return this.app.trigger("page_view:impression",this)
};
l.prototype.getRenderData=function(){return{listing:this.model.data()}
};
l.prototype.handleClickWithRouter=function(m){return this.router.followClickIfShould(m)
};
l.prototype.createSelect=function(n){var p,r,q,o,m;
o=n.modelAttrKey;
p=(typeof n.currentSelection==="function"?n.currentSelection():void 0)||this.model.get(o);
q=this.$("#"+n.selectId);
r={selectName:o,disableSelectBlock:n.disableSelectBlock,disableSelectLarge:n.disableSelectLarge,disabled:n.disabled,tooltip:n.tooltip,tooltip_position:n.tooltip_position||"top"};
m=this.transposeData(n.content,o);
if(n.placeHolder){m=[{key:n.placeHolder,value:n.placeHolder,placeHolder:true}].concat(m)
}r.values=m;
q.html(JST["manage_listing/select"](r));
if(p!==null){this.setCurrentSelectionOnSelect(q,o,p)
}if(n.tooltip){return h.bind(q)
}};
l.prototype.setCurrentSelectionOnSelect=function(o,n,m){if(m==null){m=null
}m||(m=this.model.get(n));
return o.find("[value='"+m+"']").attr("selected","selected")
};
l.prototype.transposeData=function(m){return _.map(m,function(n){return{key:n[0],value:n[1]}
})
};
l.prototype.handleSelectChange=function(p){var n,m,o;
p.preventDefault();
n=$(p.currentTarget);
o=n.val();
m=n.closest("select").attr("name");
return this.saveModelForEvent(p,this.model,m,o)
};
return l
})(d)
},{"./base_view.coffee":34,o2:"o2"}],80:[function(c,d,a){var j,h,g,b={}.hasOwnProperty,f=function(n,l){for(var k in l){if(b.call(l,k)){n[k]=l[k]
}}function m(){this.constructor=n
}m.prototype=l.prototype;
n.prototype=new m();
n.__super__=l.prototype;
return n
};
j=c("./page_view.coffee");
g=c("o2");
d.exports=h=(function(k){f(l,k);
function l(){return l.__super__.constructor.apply(this,arguments)
}l.prototype.template="manage_listing/performance_analytics";
l.prototype.initialize=function(){this.app=this.options.app;
this.data=this.app.get("performance_analytics_data");
this.chartVisible=false;
this.chartRendered=false;
moment.lang(I18n.locale());
this.ibExperiment=this.app.get("ib_perf_dashboard_exp");
this.has_viewed_ib_perf_dashboard_tooltip=false;
return l.__super__.initialize.apply(this,arguments)
};
l.prototype.events={"click .performance-analytics-summary":"toggleChartVisibility","hover #performance-analytics-container":"showAndTrackIBTooltip","click .js-not-now":"hideIbPanel","click .js-try-ib":"navigateToInstantBookSection"};
l.prototype.getRenderData=function(){var o,n,m;
o=function(p,q){return p+q
};
n=function(p){return _.reduce(p,o,0)
};
m=function(p){var q;
q=moment(p.date,"YYYY-MM-DD").format("LL");
return _.extend({date_string:q},p)
};
return{data:_.map(this.data,m),totalPageViews:n(_.map(this.data,function(p){return p.page_views
})),totalInquiries:n(_.map(this.data,function(p){return p.inquiries
})),totalBookings:n(_.map(this.data,function(p){return p.bookings
})),showExperiment3:this.ibExperiment==="3"}
};
l.prototype.toggleChartVisibility=function(p){var q,n,o,m;
if(p){p.preventDefault()
}m=$(".performance-analytics-summary");
o=m.find("i.toggle-chart-visibility");
q=$(".performance-analytics-chart-container");
m=$(".performance-analytics-summary .panel-body");
n=$(".performance-analytics-description");
if(this.chartVisible){o.removeClass("icon-chevron-up").addClass("icon-chevron-down");
q.addClass("hide");
m.removeClass("dark");
n.removeClass("hide")
}else{this.initIbPerfDashboardExp();
o.removeClass("icon-chevron-down").addClass("icon-chevron-up");
q.removeClass("hide");
m.addClass("dark");
n.addClass("hide");
if(!this.chartRendered){this.ensureD3AndRenderChart()
}}return this.chartVisible=!this.chartVisible
};
l.prototype.ensureD3AndRenderChart=function(){var n,m;
n=$(".performance-analytics-chart-container");
m=(function(o){return function(){n.removeClass("loading");
return o.renderChart()
}
})(this);
if(window.d3){return m()
}else{return LazyLoad.js(this.app.get("javascript_paths").d3,m)
}};
l.prototype.renderChart=function(){var s,q,H,p,v,aa,W,P,V,B,D,F,G,S,O,r,M,n,K,A,Y,u,E,I,J,o,N,Z,w,T,L,z,m,R,Q,X,C,U;
s=$(".performance-analytics-chart-container");
m=s.width();
n=210;
u={top:20,right:0,bottom:50,left:0};
s.height(u.top+n+u.bottom+1);
o=d3.select(".performance-analytics-chart");
o.attr("width",m+u.left+u.right);
o.attr("height",n+u.top+u.bottom);
o.append("g").append("rect").attr("class","chart-bottom").attr("x",0).attr("y",u.top+n).attr("width",u.left+m+u.right).attr("height",1);
aa=o.append("g");
aa.attr("transform","translate("+u.left+", "+u.top+")");
H=16;
V=4;
L=6;
z=1;
D=$.datepicker._defaults.firstDay;
Y=(D+6)%7;
B=function(x){return moment(x,"YYYY-MM-DD").day()
};
M=function(x){if(B(x)===D){return L+z+L
}else{return V
}};
W=_.map(this.data,function(x){return x.date
});
R=function(y){var ad,ab,ac,x;
ab=0;
for(ac=0,x=W.length;
ac<x;
ac++){ad=W[ac];
ab+=M(ad);
if(ad===y){break
}ab+=H
}return ab
};
I=_.map(this.data,function(x){return x.page_views
});
Q=d3.scale.linear().domain([0,d3.max(I)]).range([n,0]);
aa.selectAll(".bar").data(this.data).enter().append("rect").attr("class","bar").attr("id",function(x){return"tooltip-trigger-"+x.date
}).attr("x",function(x){return R(x.date)
}).attr("y",function(x){return Q(x.page_views)
}).attr("height",function(x){return n-Q(x.page_views)
}).attr("width",H);
q=2;
aa.selectAll(".bar-top").data(this.data).enter().append("rect").attr("class","bar-top").attr("x",function(x){return R(x.date)
}).attr("y",function(x){return Q(x.page_views)-q
}).attr("width",H).attr("height",q);
aa.selectAll(".inquiry-bar").data(this.data).enter().append("rect").attr("class","inquiry-bar").attr("x",function(x){return R(x.date)
}).attr("y",function(x){return Q(x.inquiries)
}).attr("height",function(x){return n-Q(x.inquiries)
}).attr("width",H);
p=function(x){if(x.inquiries===0){return Q(x.bookings)
}return Q(x.bookings)-(n-Q(x.inquiries))-2
};
aa.selectAll(".booking-bar").data(this.data).enter().append("rect").attr("class","booking-bar").attr("x",function(x){return R(x.date)
}).attr("y",p).attr("height",function(x){return n-Q(x.bookings)
}).attr("width",H);
T=function(y){var ad,ab,ac,x;
ab=0;
for(ac=0,x=W.length;
ac<x;
ac++){ad=W[ac];
if(ad===y){ab+=L;
break
}ab+=M(ad)+H
}return ab
};
G=_.filter(this.data,function(x){return B(x.date)===D
});
aa.selectAll(".week-divider").data(G).enter().append("rect").attr("class","week-divider").attr("x",function(x){return T(x.date)
}).attr("y",-u.top).attr("width",z).attr("height",u.top+n+u.bottom);
F=_.uniq([this.data[0]].concat(G));
v=(function(x){return function(ab){var y,ae,ad,af,ac;
ae=x.data.indexOf(ab);
y=moment(ab.date,"YYYY-MM-DD");
ac=moment(y).add("days",D+7-y.day());
ad=moment(x.data[x.data.length-1].date,"YYYY-MM-DD");
af=_.min([ac,ad],function(ag){return ag.valueOf()
});
return[y,af]
}
})(this);
w=(function(x){return function(ag){var ai,ab,ah,ac,y,ae,af,ad;
ai=function(aj,ak){return aj+ak
};
af=function(aj){return _.reduce(aj,ai,0)
};
ab=v(ag);
ah=_.map(ab,function(aj){return aj.format("YYYY-MM-DD")
});
ad=_.map(ah,function(aj){return W.indexOf(aj)
}),y=ad[0],ae=ad[1];
ac=_.map(x.data.slice(y,ae),function(aj){return aj.page_views
});
return af(ac)
}
})(this);
E=(function(x){return function(ab){var y,ad,ac;
ac=v(ab),y=ac[0],ad=ac[1];
return ad.diff(y,"days")
}
})(this);
J=function(x){return E(x)===7
};
S=function(x){if(I18n.locale().slice(-2)==="CH"){return x.format("DD.MM")
}else{if(I18n.locale()==="en"){return x.format("MM/DD")
}else{switch(I18n.language()){case"de":return x.format("DD.MM");
case"en":case"es":case"fr":case"it":case"pt":return x.format("DD/MM");
default:return x.format("L")
}}}};
O=function(y){var ae,x,ab,ad,ac;
if(!J(y)){return""
}ac=v(y),x=ac[0],ab=ac[1];
ad=ab.subtract("days",1);
return ae=""+(S(x))+" - "+(S(ad))
};
r=function(x){var y;
if(!J(x)){return""
}y=w(x);
return I18n.t("ml.performance_analytics.page_views",{smart_count:y})
};
K=function(x){if(B(x.date)===D){return T(x.date)+V+H/2
}else{return R(x.date)+H/2
}};
A=aa.selectAll(".week-label").data(F).enter().append("text").attr("class","week-label").attr("x",K).attr("y",u.top+n);
A.append("tspan").attr("class","date-range-label").text(O).attr("x",K);
A.append("tspan").text(r).attr("x",K).attr("dy","1.0em");
U=this.data;
for(X=0,C=U.length;
X<C;
X++){P=U[X];
N="#tooltip-"+P.date;
Z="#tooltip-trigger-"+P.date;
new g.Tooltip(N,Z)
}return this.chartRendered=true
};
l.prototype.initIbPerfDashboardExp=function(){if(this.ibExperiment==="2"&&!this.model.get("has_viewed_ib_perf_dashboard_panel")){this.trackUpsellEvent("v2","impression");
return this.showIbExp2Html()
}else{if(this.ibExperiment==="control"){return this.trackUpsellEvent("v1","impression")
}}};
l.prototype.showIbExp2Html=function(){var m;
this.$ibExp2El=this.$("#ib-perf-dashboard-exp");
m=JST["manage_listing/ib-perf-dashboard-exp/ib-upsell-2"]();
return this.$ibExp2El.html(m)
};
l.prototype.hideIbPanel=function(){this.trackUpsellEvent("v2","click_not_now");
this.markIbPanelAsViewed();
return this.$ibExp2El.remove()
};
l.prototype.navigateToInstantBookSection=function(m){if(m.target.id==="ib-perf-dashboard-button"){this.trackUpsellEvent("v2","click_try_ib")
}else{if(m.target.id==="ib-tooltip-button"){this.trackUpsellEvent("v3","click_try_ib")
}}this.markIbPanelAsViewed();
return this.app.router.handleLinkClick("instant-book")
};
l.prototype.markIbPanelAsViewed=function(){this.model.set("has_viewed_ib_perf_dashboard_panel",true);
return this.model.save()
};
l.prototype.showAndTrackIBTooltip=function(m){if(this.ibExperiment==="3"&&!this.has_viewed_ib_perf_dashboard_tooltip){this.trackUpsellEvent("v3","impression");
this.has_viewed_ib_perf_dashboard_tooltip=true
}return this.showTooltipSticky(m)
};
l.prototype.trackUpsellEvent=function(n,m){return Airbnb.Tracking.logEvent({event_name:"instant_book",event_data:{experiment_name:"performance_dashboard_upsell",experiment_group:n,operation:m,page:"manage_listing",section:"performance_dashboard",hosting_id:this.model.id}})
};
return l
})(j)
},{"./page_view.coffee":79,o2:"o2"}],81:[function(d,b,g){var a,k,c,h=function(l,m){return function(){return l.apply(m,arguments)
}
},j={}.hasOwnProperty,f=function(o,m){for(var l in m){if(j.call(m,l)){o[l]=m[l]
}}function n(){this.constructor=o
}n.prototype=m.prototype;
o.prototype=new n();
o.__super__=m.prototype;
return o
};
c=d("o2");
a=d("./page_view.coffee");
b.exports=k=(function(m){f(l,m);
function l(){this.uploadFiles=h(this.uploadFiles,this);
this.uploadComplete=h(this.uploadComplete,this);
this.fileUploaded=h(this.fileUploaded,this);
this.uploadFile=h(this.uploadFile,this);
this.initializeUploader=h(this.initializeUploader,this);
this.onOrderChange=h(this.onOrderChange,this);
return l.__super__.constructor.apply(this,arguments)
}l.prototype.shouldPreserveInBackground=true;
l.prototype.id="photos";
l.prototype.tracking_name="photos";
l.prototype.initialize=function(){this.app=this.options.app;
window.photoview=this;
return l.__super__.initialize.apply(this,arguments)
};
l.prototype.bodyClassName="wide-content-section";
l.prototype.events={"change textarea":"saveCaption","click .js-delete-photo-btn":"launchDeleteModal","mouseenter .sortable li:first-child":"showFirstPhotoText","mouseleave .sortable li:first-child":"hideFirstPhotoText","hover #js-photo-grid":"showTooltipSticky","hover #js-add-photos-header":"showProPhotoTooltip","click .js-photo-link":"launchPhotoModal","click #js-pro-photo-link":"proPhotoClickHandler","click #js-pro-photo-cancel":"cancelProPhotography"};
l.prototype.bindings=function(){l.__super__.bindings.apply(this,arguments);
this.model.on("change:photos",this.updatePhotoCount,this);
this.model.on("change:photos",this.checkForZeroPhotos,this);
this.on("render:dom_inserted",this.initializeUploader);
return this.on("preservedView:didDisplay",this.preservedViewDidDisplay,this)
};
l.prototype.getRenderData=function(){var n;
n=l.__super__.getRenderData.apply(this,arguments);
if(n.listing.photography_status!=null){_.extend(n.listing,{photographyComplete:n.listing.photography_status==="complete",photographyRequested:n.listing.photography_status==="requested",photographyAvailable:n.listing.photography_status==="available",photographyUnavailable:n.listing.photography_status==="unavailable"})
}return n
};
l.prototype.proPhotoClickHandler=function(){return this.model.trigger("tracking:pro_photo_apply_now_click")
};
l.prototype.cancelProPhotography=function(q){var p,o,n;
q.preventDefault();
o=$(q.currentTarget);
p=o.closest(".manage-listing-content").addClass("loading");
n=o.attr("href");
return $.get(n,(function(r){return function(s){o.parent().fadeOut();
p.removeClass("loading");
if(s.success){return Flash.success(t("photography.cancelation_success"))
}else{return Flash.error(t("photography.cancelation_error"))
}}
})(this))
};
l.prototype.cleanup=function(){$("body").off("click","#js-pro-photo-link",this.proPhotoClickHandler);
return l.__super__.cleanup.apply(this,arguments)
};
l.prototype.preservedViewDidDisplay=function(){return this.initSortable()
};
l.prototype.getTemplate=function(){var n;
if(_.isEmpty(this.model.get("photos"))){n=JST["manage_listing/photos_welcome"]
}else{n=JST["manage_listing/photos"]
}return n
};
l.prototype.initSortable=function(){var n;
n=this.$el.find(".sortable").sortable();
n.off("sortupdate",this.onOrderChange);
return n.on("sortupdate",this.onOrderChange)
};
l.prototype.postRender=function(){l.__super__.postRender.apply(this,arguments);
this.initSortable();
this.updatePhotoCount();
this.trackProPhotographyVisibility();
c.Modal.bind(this.$el);
return this.updateTabIndex(this.getSortables())
};
l.prototype.trackProPhotographyVisibility=function(){if(this.model.get("photography_status")==="available"){return Airbnb.Tracking.logEvent({event_name:"pro_photography_link_displayed",event_data:{id_listing:this.model.get("id")}})
}};
l.prototype.showProPhotoTooltip=function(n){if(this.model.get("has_ever_been_available")&&this.app.get("hosting_is_near_a_photographer")){this.showTooltipSticky(n);
return this.app.trigger("tracking:pro_photo_tooltip_impression")
}};
l.prototype.saveCaption=function(q){var n,p,s,o,r;
p=this.$(q.currentTarget);
s=parseInt(p.attr("name"),10);
n=p.val();
r=this.model.get("photos");
o=_.find(r,function(u){return u.id===s
});
o.caption=n;
return this.saveModel(r)
};
l.prototype.updateTabIndex=function(n){return n.each(function(o,p){return $(p).find(".highlights").attr("tabindex",o+1)
})
};
l.prototype.onOrderChange=function(){var v,p,y,w,n,q,s,r,x,o,u;
w=this.getSortables();
this.updateTabIndex(w);
q={};
u=this.model.get("photos");
for(v=s=0,x=u.length;
s<x;
v=++s){n=u[v];
q[n.id]=n
}for(v=r=0,o=w.length;
r<o;
v=++r){y=w[v];
p=this.$(y).data("id");
n=q[p];
n.sort_order=v+1
}return this.saveModel(this.model.get("photos"))
};
l.prototype.saveModel=function(n){if(this.pendingXHR){return this.mostRecentPhotoChange=n
}else{_.extend(this.model._changedSinceSave,{photos:n});
this.pendingXHR=this.saveModelAndTrackProgressInSection(this.model,$(".section-photos"));
this.mostRecentPhotoChange=[];
return this.pendingXHR.done((function(o){return function(){o.pendingXHR=null;
if(o.mostRecentPhotoChange.length){return o.saveModel(o.mostRecentPhotoChange)
}}
})(this))
}};
l.prototype.initializeUploader=function(){this.uploader=new plupload.Uploader({runtimes:"html5,flash,html4",browse_button:"photo-uploader",flash_swf_url:"/swf/plupload.flash.swf",silverlight_xap_url:"/xap/plupload.silverlight.xap",url:this.model.authenticatedUrlForMethod("update"),multipart:true,file_data_name:"photos[]",multipart_params:Airbnb.Api.params(),filters:[{title:"Image files",extensions:"jpg,jpeg,png"}],headers:{"X-CSRF-Token":Airbnb.getCSRFToken()}});
this.uploader.bind("UploadFile",this.uploadFile);
this.uploader.bind("FileUploaded",this.fileUploaded);
this.uploader.bind("UploadComplete",this.uploadComplete);
this.uploader.bind("UploadProgress",this.updateFileCounter,this);
this.uploader.bind("UploadFile",this.showLoadingIndicator,this);
this.uploader.bind("UploadComplete",this.hideLoadingIndicator,this);
this.uploader.bind("Error",this.hideLoadingIndicator,this);
this.uploader.init();
return this.uploader.bind("FilesAdded",this.uploadFiles)
};
l.prototype.showLoadingIndicator=function(){return this.app.trigger("loading",{view:"photos",isCurrentlyLoading:true})
};
l.prototype.hideLoadingIndicator=function(){return this.app.trigger("loading",{view:"photos",isCurrentlyLoading:false})
};
l.prototype.updateFileCounter=function(){var o,p,w,n,s,u,q,v,r;
u=this.uploader.files.length;
s=0;
o=0;
r=this.uploader.files;
for(q=0,v=r.length;
q<v;
q++){p=r[q];
if(p.status!==plupload.QUEUED){s++
}if(!(p.status===plupload.QUEUED||p.status===plupload.UPLOADING)){o++
}}if(o===u){return this.updatePhotoCount()
}else{n=(_.reduce(this.uploader.files,(function(x,y){return y.percent+x
}),0)/(100*u))*100;
w=JST["manage_listing/upload_progress"]({progress:n});
return this.$(".js-photo-status").html(w)
}};
l.prototype.updatePhotoCount=function(){var n,o;
o=this.$(".js-photo-status");
n=this.model.get("photos").length;
return o.html(JST["manage_listing/photo_count"]({photoCount:n}))
};
l.prototype.checkForZeroPhotos=function(){var n;
n=this.model.get("photos").length;
if(n===0){this.render();
return this.initializeUploader()
}};
l.prototype.rerenderIfIsFirstUpload=function(){var n,o;
if(_.isEmpty(this.model.get("photos"))){n=this.$("#photo-uploader");
this.$el.html(JST["manage_listing/photos"](this.model,{partials:JST}));
this.initO2();
o=/MSIE (\d+\.\d+);/.test(navigator.userAgent);
if(!o&&this.isHTML5()){return this.$("#photo-uploader").replaceWith(n)
}}};
l.prototype.isHTML5=function(){return this.uploader.runtime==="html5"
};
l.prototype.updatePhotoList=function(){this.showNewUploadedPhoto();
return this.initSortable()
};
l.prototype.showNewUploadedPhoto=function(){var o,n,p;
p=this.model.get("photos");
o=this.$(".photo-item-loading").first();
n=_.last(p);
o.replaceWith(JST["manage_listing/photo_item"]({index:p.length-1,id:n.id,thumbnail:n.thumbnail,picture:n.picture,caption:n.caption}));
this.$("[data-id='"+n.id+"']").find(".highlights").attr("tabindex",p.length);
return this.placeHolderShim()
};
l.prototype.uploadFile=function(o,n){return this.updateFileCounter()
};
l.prototype.fileUploaded=function(r,o,n){var q,p;
try{if(n!=null){p=this.model.parse(JSON.parse(n.response));
this.model.set(p);
return this.updatePhotoList()
}else{return this.model.fetch().then((function(u){return function(){return u.updatePhotoList()
}
})(this))
}}catch(s){q=s;
return this.launchErrorModal()
}};
l.prototype.launchErrorModal=function(){var o,n;
n=JST["manage_listing/photo_upload_error_notice"]();
o=new c.Modal(n);
o.on("open",(function(p){return function(){p.render();
return p.initializeUploader()
}
})(this));
return o.open()
};
l.prototype.uploadComplete=function(n){if(n.runtime==="html4"){this.fileUploaded()
}return this.updateFileCounter()
};
l.prototype.uploadFiles=function(p){var o,r,n,q;
this.rerenderIfIsFirstUpload();
this.$el.trigger("photos:upload",p);
this.updateFileCounter();
this.$(".photo-item-loading").remove();
q=p.files;
for(r=0,n=q.length;
r<n;
r++){o=q[r];
if(o.status===plupload.QUEUED||o.status===plupload.UPLOADING){this.$(".sortable").append(JST["manage_listing/photo_item"]({loading:true}))
}}return this.uploader.start()
};
l.prototype.launchDeleteModal=function(r){var q,p,n,o;
if(this.isLastPhotoAndIsPublished()){p=JST["manage_listing/delete_last_photo_notice"]()
}else{n=$(r.currentTarget).data("photo-id");
o=$(r.currentTarget).closest(".photo-item").trigger("delete:click");
p=JST["manage_listing/delete_photo_confirmation"]({id:n})
}q=$(p);
q.on("click",".js-delete-photo-confirm",(function(s){return function(u){return s.deletePhoto(u)
}
})(this));
this.deletePhotoModal=new c.Modal(q);
return this.deletePhotoModal.open()
};
l.prototype.deletePhoto=function(r){var p,o,q,n,s;
r.preventDefault();
o=$(r.currentTarget).data("photo-id");
q=this.$(".sortable").find("[data-id="+o+"]");
q.trigger("delete:confirm");
s=this.model.get("photos");
n=_.findWhere(s,{id:o});
q.remove();
p=n.index;
n._destroy=true;
s[p]=n;
this.saveModel(s);
this.deletePhotoModal.close();
this.deletePhotoModal.$element.remove();
return this.updateTabIndex(this.getSortables())
};
l.prototype.showFirstPhotoText=function(){this.$firstPhotoHelpTextEl||(this.$firstPhotoHelpTextEl=this.$("#js-first-photo-text"));
return this.$firstPhotoHelpTextEl.removeClass("invisible")
};
l.prototype.hideFirstPhotoText=function(){return this.$firstPhotoHelpTextEl.addClass("invisible")
};
l.prototype.isLastPhotoAndIsPublished=function(){var n;
n=this.$(".photo-item").length;
return n===1&&this.model.get("has_availability")
};
l.prototype.launchPhotoModal=function(q){var p,o,n;
n=$(q.currentTarget).closest("li").data("picture-url");
o=JST["manage_listing/photo_item_modal"]({pictureUrl:n});
p=$(o);
if(this.photoItemModal){this.photoItemModal.$element.remove()
}this.photoItemModal=new c.Modal(p);
return this.photoItemModal.open()
};
l.prototype.getSortables=function(){return this.$(".sortable li:not(.photo-item-loading)")
};
return l
})(a)
},{"./page_view.coffee":79,o2:"o2"}],82:[function(d,f,b){var a,j,h,c={}.hasOwnProperty,g=function(n,l){for(var k in l){if(c.call(l,k)){n[k]=l[k]
}}function m(){this.constructor=n
}m.prototype=l.prototype;
n.prototype=new m();
n.__super__=l.prototype;
return n
};
a=d("./advanced_pricing_view.coffee");
j=d("./page_view.coffee");
f.exports=h=(function(k){g(l,k);
function l(){return l.__super__.constructor.apply(this,arguments)
}l.prototype.template="manage_listing/pricing";
l.prototype.tracking_name="pricing";
l.prototype.events={"change input[type=checkbox]":"updateCheckboxInput","change .autosubmit-text":"updateTextInput","change select":"handleSelectChange","hover .js-tooltip-trigger":"showTooltipSticky","click #js-set-long-term-prices a":"showLongTermPrices","click .js-set-advanced-prices":"renderAdvancedPricingView","click .js-edit-advanced-prices":"renderAdvancedPricingView"};
l.prototype.mapErrorKeysToModelAttrs={price:"listing_price_native",weekly_price:"listing_weekly_price_native",monthly_price:"listing_monthly_price_native",extras_price:"listing_cleaning_fee_native",price_for_extra_person:"listing_price_for_extra_person_native",security_deposit:"listing_security_deposit_native"};
l.prototype.autopriceTypes=["cleaning","daily","weekly","monthly"];
l.prototype.initialize=function(){this.app=this.options.app;
return l.__super__.initialize.apply(this,arguments)
};
l.prototype.postInitialize=function(){this.listenTo(this.model,"saving:success:listing_native_currency",this.render);
this.listenTo(this.model,"saving:success",this.displayErrors);
this.listenTo(this.app,"disaster:not_in_disaster_zone",this.hideDisasterPricingTip);
return this.listenTo(this.app,"disaster:opted_out",this.hideDisasterPricingTip)
};
l.prototype.showLongTermPrices=function(m){if(m){m.preventDefault
}this.$("#js-set-long-term-prices").addClass("hide");
return this.$("#js-long-term-prices").removeClass("hide")
};
l.prototype.displayErrors=function(){var m;
m=this.model.get("errors");
this.$(".ml-error").addClass("hide");
this.$(".invalid").removeClass("invalid");
if(m){return _.each(m,(function(n){return function(q,o){var p,r;
p=n.mapErrorKeysToModelAttrs[o];
r=n.model.get(p);
n.$("input[name="+p+"]").val(r).addClass("invalid");
return n.$(".ml-error[data-error="+o+"]").html(q).removeClass("hide")
}
})(this))
}};
l.prototype.hideDisasterPricingTip=function(){return $("#js-disaster-pricing-tip").addClass("hide")
};
l.prototype.getRenderData=function(){var q,p,n,m,o;
n=this.model.get("ap_pricing");
o=this.app.get("show_autoprices");
q={};
p=this.app.get("applicable_disaster");
m=this.model.get("has_ever_been_available");
if(o){q=this.autopriceTypes.reduce(function(r,s){if(n[s]>0){r[s]=I18n.priceString(n[s],n.currency)
}else{r[s]=false
}return r
},{})
}return _.extend(this.model.data(),{ap_cleaning:o?q.cleaning:void 0,ap_daily:o?q.daily:void 0,ap_weekly:o?q.weekly:void 0,ap_monthly:o?q.monthly:void 0,currency_symbol:this.model.currencySymbol(),show_cleaning_fee_section:this.model.get("listing_cleaning_fee_native")||this.model.get("errors").extras_price,show_weekend_pricing_section:this.model.get("listing_weekend_price_native"),show_additional_charges_section:this.model.get("listing_price_for_extra_person_native")||this.model.get("errors").price_for_extra_person,show_security_deposit_section:this.model.get("listing_security_deposit_native")||this.model.get("errors").security_deposit,disaster:p,disasterRegionName:p?p.disaster.affected_region_name:void 0,disasterStartDate:p?moment(new Date(p.disaster.start_time)).format("LL"):void 0,disasterEndDate:p?moment(new Date(p.disaster.stop_time)).format("LL"):void 0,shouldShowCalendarLink:m,calendarAnchorTag:"<a href='/manage-listing/"+this.model.id+"/calendar'>"})
};
l.prototype.postRender=function(){Airbnb.LangCurrPicker.init();
this.renderCurrencyPicker();
this.initSelects();
if(this.shouldShowLongTermPrices()){this.showLongTermPrices()
}if(this.model.get("has_ever_been_available")){this.prepareAdvancedPricing()
}return this.logPricingInformation("impression",null)
};
l.prototype.shouldShowLongTermPrices=function(){var m;
return m=this.model.get("has_ever_been_available")||this.model.get("listing_weekly_price_native")||this.model.get("listing_monthly_price_native")||this.model.get("errors").weekly_price||this.model.get("errors").monthly_price
};
l.prototype.initSelects=function(){return this.createSelect({modelAttrKey:"guests_included",selectId:"guests-included-select",content:this.app.get("person_capacity")})
};
l.prototype.updateCheckboxInput=function(r){var o,m,u,s,q,p,n;
o=$(r.currentTarget);
s=o.prop("id");
m=this.$("[data-checkbox-id='"+s+"']");
q=o.prop("checked");
u=m.find(".autosubmit-text");
if(!q){u.val("").trigger("change");
return m.addClass("hide")
}else{m.removeClass("hide");
n=s.substr(0,s.lastIndexOf("_price_native"));
p=this.model.get("ap_pricing")[n];
if(p&&p>0){return u.val(p).trigger("change")
}}};
l.prototype.updateTextInput=function(o){var p,m,n;
p=$(o.currentTarget);
m=p.attr("name");
n=p.val();
$.when(this.saveModelForEvent(o,this.model,m,n)).done((function(q){return function(){var u,r,s;
if(_.contains(["listing_weekend_price_native","listing_price_native"],m)){r=new Date();
u=r.getMonth()+1;
s=r.getFullYear();
return jQuery.ajax({type:"GET",url:"/calendar/single/"+q.model.id+"?month="+u+"&year="+s,dataType:"json",success:function(v){return window.bootstrap_json=v
}})
}}
})(this));
return this.logPricingInformation("change",m)
};
l.prototype.renderCurrencyPicker=function(){var q,m,p,n,o;
m=[];
o=I18n.currencies();
for(p=0,n=o.length;
p<n;
p++){q=o[p];
m.push([q,q])
}return this.createSelect({modelAttrKey:"listing_native_currency",selectId:"currency-picker",content:m})
};
l.prototype.prepareAdvancedPricing=function(){if(!this.advancedPricingView){this.advancedPricingView=new a({el:this.$("#js-advanced-pricing-content"),model:this.model,app:this.app})
}return this.listenTo(this.advancedPricingView,"advanced_pricing:changed",this.showAdvancedPricingLinks)
};
l.prototype.showAdvancedPricingLinks=function(){var n,m;
n=JST["manage_listing/pricing/advanced_pricing_cta"];
m=["weekly","monthly"];
return _.each(m,(function(o){return function(s){var r,q,p;
if(s==="weekly"){q=true
}p={count:o.advancedPricingView.getCount(s),type:s,isWeekly:q};
r=n(p);
return o.$(".js-advanced-"+s+"-pricing").html(r)
}
})(this))
};
l.prototype.renderAdvancedPricingView=function(n){var m;
n.preventDefault();
m=$(n.currentTarget).data("type");
return this.advancedPricingView.renderCustomPricingView(m)
};
l.prototype.logPricingInformation=function(o,p){var q,m,n;
m=this.model.get("ap_pricing");
n=this.app.get("show_autoprices");
q={};
if(n){q=this.autopriceTypes.reduce(function(r,s){if(m[s]>0){r[s]=m[s]
}else{r[s]=false
}return r
},{})
}return Airbnb.Tracking.logEvent({event_name:"ml_autopricing",event_data:{page:"manage_listing/pricing",listing:this.model.get("id"),action:o,target:p,suggested_daily:q.daily,suggested_weekly:q.weekly,suggested_monthly:q.monthly,suggested_cleaning:q.cleaning,price_native:this.model.get("listing_price_native"),weekly_price_native:this.model.get("listing_weekly_price_native"),monthly_price_native:this.model.get("listing_monthly_price_native"),cleaning_fee_native:this.model.get("listing_cleaning_fee_native"),weekend_price_native:this.model.get("listing_weekend_price_native"),price_for_extra_person_native:this.model.get("listing_price_for_extra_person_native"),security_deposit_native:this.model.get("listing_security_deposit_native")}})
};
return l
})(j)
},{"./advanced_pricing_view.coffee":31,"./page_view.coffee":79}],83:[function(c,a,f){var g,k,l,b,h=function(m,n){return function(){return m.apply(n,arguments)
}
},j={}.hasOwnProperty,d=function(p,n){for(var m in n){if(j.call(n,m)){p[m]=n[m]
}}function o(){this.constructor=p
}o.prototype=n.prototype;
p.prototype=new o();
p.__super__=n.prototype;
return p
};
b=c("o2");
g=c("./base_view.coffee");
k=c("./list_space_modal_view.coffee");
a.exports=l=(function(n){d(m,n);
function m(){this.trackCremeBrulee=h(this.trackCremeBrulee,this);
this.positionTooltip=h(this.positionTooltip,this);
this.animateAndShowLYSButton=h(this.animateAndShowLYSButton,this);
return m.__super__.constructor.apply(this,arguments)
}m.prototype.initialize=function(){var o;
this.app=this.options.app;
this.model=this.app.listing;
if(this.app!=null){this.app.trigger("impression",this)
}this.router=this.options.router;
this.bindings();
this.shouldShowCremeBrulee=((o=this.model.get("country"))==="France"||o==="FR")&&this.app.get("lys_creme_brulee");
return this.render()
};
m.prototype.template="manage_listing/publish_button";
m.prototype.tracking_name="list_space_button_left_nav";
m.prototype.events={"click button":"clickListSpace"};
m.prototype.clickListSpace=function(o){o.preventDefault();
this.hideTooltip();
return this.handleListSpaceClick(o)
};
m.prototype.handleListSpaceClick=function(q){var p,o;
q.preventDefault();
p=$(q.currentTarget);
if(p.hasClass("disabled")){return
}if(this.model.isReadyToList()){o=new k({app:this.app,model:this.app.listing,router:this.app.router});
return o.render()
}else{if(p.data("track")==="list_space_button_left_nav"){this.app.trigger("listing_space","list_space_left_nav_click_and_verify_profile")
}return this.router.navigateToBestRoute()
}};
m.prototype.bindings=function(){this.listenTo(this.model,"change:steps_remaining",this.updateStepsRemainingAndListSpaceUi);
return this.listenTo(this.model,"change:has_agreed_to_legal_terms",this.updateStepsRemainingAndListSpaceUi)
};
m.prototype.getRenderData=function(){var o;
o=this.model.attributes.user.user.first_name;
return _.extend({},this.model.data,{firstName:o,shouldShowCremeBrulee:this.shouldShowCremeBrulee,isFrenchLocale:Airbnb.options.locale==="fr"})
};
m.prototype.postRender=function(){m.__super__.postRender.apply(this,arguments);
this.initTooltip();
return this.updateStepsRemainingAndListSpaceUi()
};
m.prototype.initTooltip=function(){this.listSpaceTooltip=new b.Tooltip("#js-list-space-tooltip","#js-list-space-button",{event:"none"});
this.listSpaceTooltip.$element.on("click",".link-france",(function(o){return function(p){return o.trackCremeBrulee("clicked_link")
}
})(this));
return this.listSpaceTooltip.$element.on("click",".panel-close",(function(o){return function(p){p.preventDefault();
return o.hideTooltip()
}
})(this))
};
m.prototype.showTooltip=function(){if(!this.isIE()){this.listSpaceTooltip.$element.addClass("anim-fade-in-up").css({position:"fixed"})
}this.listSpaceTooltip.show();
this.listSpaceTooltip.$element.addClass("visible");
this.positionTooltip();
$(window).on("resize",this.positionTooltip);
if(this.shouldShowCremeBrulee){return this.trackCremeBrulee("impression")
}};
m.prototype.hideTooltip=function(){$(window).off("resize",this.positionTooltip);
if(!this.isIE()){this.listSpaceTooltip.$element.removeClass("anim-fade-in-up")
}this.listSpaceTooltip.hide();
if(this.shouldShowCremeBrulee){return this.trackCremeBrulee("hide")
}};
m.prototype.removeAnimationClasses=function(o){var p;
p=/\banim-\S+/g;
return o.attr("class",function(q,r){return r.replace(p,"")
})
};
m.prototype.updateStepsRemainingAndListSpaceUi=function(){var q,p,o,r;
o=this.model.get("steps_remaining");
p=this.$(".js-steps-remaining");
q=this.$("#js-list-space-button");
r=t("ml.publish.x_steps_to_list",{before_steps_html:'<strong class="text-highlight">',after_steps_html:"</strong>",smart_count:o});
if(o===0){if($("body").hasClass("modal-open")){return $(".modal").data("o2-modal").on("close",(function(s){return function(){return s.updateStepsRemainingAndListSpaceUi()
}
})(this))
}else{return this.animateAndShowLYSButton()
}}else{this.hideTooltip();
p.html(r);
p.removeClass("anim-fade-out-scale-down").css({display:"block",opacity:1});
return q.removeClass("anim-flip-in-Y").css({display:"none"})
}};
m.prototype.animateAndShowLYSButton=function(){var q,p,o;
o="webkitAnimationEnd oAnimationEnd animationend";
p=this.$(".js-steps-remaining");
q=this.$("#js-list-space-button");
if(this.isIE()){p.css({display:"none"});
q.css({display:"inline-block"});
return this.showTooltip()
}else{p.on(o,(function(r){return function(){p.css({display:"none"});
return q.css({opacity:0,display:"inline-block"}).addClass("anim-flip-in-Y")
}
})(this));
q.on(o,(function(r){return function(){return r.showTooltip()
}
})(this));
this.removeAnimationClasses(p);
return p.addClass("anim-fade-out-scale-down")
}};
m.prototype.isIE=function(){return $("html").hasClass("ie")
};
m.prototype.positionTooltip=function(){var o,p;
p=this.listSpaceTooltip.$element.outerHeight();
o=$("#js-list-space-button").offset().top-$(window).scrollTop()-p-20;
return this.listSpaceTooltip.$element.css({top:o})
};
m.prototype.trackCremeBrulee=function(o){return Airbnb.Tracking.logEvent({event_name:"creme_brulee",event_data:{experiment:"lys_creme_brulee",event_action:o,hosting_id:this.model.id}})
};
return m
})(g)
},{"./base_view.coffee":34,"./list_space_modal_view.coffee":70,o2:"o2"}],84:[function(b,a,d){var g,j,h,k,f={}.hasOwnProperty,c=function(o,m){for(var l in m){if(f.call(m,l)){o[l]=m[l]
}}function n(){this.constructor=o
}n.prototype=m.prototype;
o.prototype=new n();
o.__super__=m.prototype;
return o
};
j=b("../models/cleaning_job.coffee");
g=b("./cleaning_helper_view.coffee");
h=b("./cleaning_job_view.coffee");
a.exports=k=(function(m){c(l,m);
function l(){return l.__super__.constructor.apply(this,arguments)
}l.prototype.template="manage_listing/cleaning/reservation";
l.prototype.tagName="li";
l.prototype.initialize=function(){this.app=this.options.app;
this.subviews=[];
this.reservation=this.options.reservation;
this.checkinPref=this.options.beforeCheckinPreference;
return this.checkoutPref=this.options.afterCheckoutPreference
};
l.prototype.getRenderData=function(){return{reservation:this.reservation}
};
l.prototype.checkinJob=function(){return this.reservation.cleaning_jobs.find(function(n){return n.isCheckin()
})
};
l.prototype.checkoutJob=function(){return this.reservation.cleaning_jobs.find(function(n){return n.isCheckout()
})
};
l.prototype.postRender=function(){this.checkinJobView=new h({app:this.app,reservation:this.reservation,job:this.checkinJob(),preference:this.checkinPref,schedule_type:j.SCHEDULE_TYPE_CHECKIN});
this.subviews.push(this.checkinJob);
this.$el.find(".js-checkin-job").append(this.checkinJobView.render().$el);
this.checkoutJobView=new h({app:this.app,reservation:this.reservation,job:this.checkoutJob(),preference:this.checkoutPref,schedule_type:j.SCHEDULE_TYPE_CHECKOUT});
this.subviews.push(this.checkoutJob);
return this.$el.find(".js-checkout-job").append(this.checkoutJobView.render().$el)
};
return l
})(g)
},{"../models/cleaning_job.coffee":11,"./cleaning_helper_view.coffee":43,"./cleaning_job_view.coffee":44}],85:[function(d,g,b){var a,j,f,c={}.hasOwnProperty,h=function(n,l){for(var k in l){if(c.call(l,k)){n[k]=l[k]
}}function m(){this.constructor=n
}m.prototype=l.prototype;
n.prototype=new m();
n.__super__=l.prototype;
return n
};
a=d("./min_max_nights_view.coffee");
j=d("./page_view.coffee");
g.exports=f=(function(l){h(k,l);
function k(){return k.__super__.constructor.apply(this,arguments)
}k.prototype.template="manage_listing/terms";
k.prototype.tracking_name="terms";
k.prototype.events={"change select":"handleSelectChange","blur input[name=license]":"handleBlur"};
k.prototype.initialize=function(){this.app=this.options.app;
this.subviews=[];
return k.__super__.initialize.apply(this,arguments)
};
k.prototype.bindings=function(){k.__super__.bindings.apply(this,arguments);
return this.listenTo(this,"render:dom_inserted",this.onDomInserted)
};
k.prototype.onDomInserted=function(){this.initMinMaxNights();
this.initSelects();
return this.updateTermsViewed()
};
k.prototype.initMinMaxNights=function(){this.minmaxView=new a({el:this.$("#min-max-nights"),model:this.model});
return this.subviews.push(this.minmaxView)
};
k.prototype.initSelects=function(){this.createSelect({modelAttrKey:"cancel_policy",selectId:"cancellation-policy-select",content:this.app.get("cancellation_options")});
this.createSelect({modelAttrKey:"check_in_time",selectId:"check-in-time-select",content:this.app.get("checkinout_time_options")});
return this.createSelect({modelAttrKey:"check_out_time",selectId:"check-out-time-select",content:this.app.get("checkinout_time_options")})
};
k.prototype.updateTermsViewed=function(){if(!this.model.get("has_viewed_terms")){this.model.set("has_viewed_terms",true);
return this.model.save()
}};
k.prototype.getRenderData=function(){var m;
m=k.__super__.getRenderData.apply(this,arguments);
m.enableTaxId=this.app.get("enable_tax_id");
return m
};
return k
})(j)
},{"./min_max_nights_view.coffee":74,"./page_view.coffee":79}],86:[function(c,f,a){var d,j,h,b={}.hasOwnProperty,g=function(n,l){for(var k in l){if(b.call(l,k)){n[k]=l[k]
}}function m(){this.constructor=n
}m.prototype=l.prototype;
n.prototype=new m();
n.__super__=l.prototype;
return n
};
h=c("o2");
d=c("./base_view.coffee");
f.exports=j=(function(k){g(l,k);
function l(){return l.__super__.constructor.apply(this,arguments)
}l.prototype.template="manage_listing/welcome_new_host_modal";
l.prototype.tracking_name="welcome_modal";
l.prototype.initialize=function(){this.app=this.options.app;
this.launchModal();
return l.__super__.initialize.apply(this,arguments)
};
l.prototype.getRenderData=function(){return{newUser:this.app.get("new_user")}
};
l.prototype.launchModal=function(){var m;
m=$(this.getHtml());
this.welcomeModal=new h.Modal(m,{sticky:true});
this.welcomeModal.open();
this.animate();
return m.on("click",".js-finish",(function(n){return function(){return n.closeModal()
}
})(this))
};
l.prototype.animate=function(){$(".steps-remaining-circle").delay(500).queue((function(m){return function(){$(".steps-remaining-circle").addClass("anim-bounce-in");
return $(".steps-remaining-circle").addClass("visible")
}
})(this));
return $(".steps-remaining-more-text").delay(1000).queue((function(m){return function(){return $(".steps-remaining-more-text").addClass("fade-in")
}
})(this))
};
l.prototype.closeModal=function(){this.model.set({has_ever_been_edited:true});
this.model.save();
this.welcomeModal.close();
return this.app.trigger("welcome_modal_closed")
};
return l
})(d)
},{"./base_view.coffee":34,o2:"o2"}],87:[function(c,d,a){var b=function(f,g){return function(){return f.apply(g,arguments)
}
};
Airbnb.InputKeywordScanner=(function(){function f(g){this.scan=b(this.scan,this);
_.extend(this,Backbone.Events);
this._inputs=g.inputs;
this._keywords=g.keywords;
this._dictionary=this.buildDictionary();
this._inputs.on("keyup",this.scan)
}f.prototype.buildDictionary=function(){return _.map(this._keywords,function(g){return new RegExp(g,"i")
})
};
f.prototype.scan=function(j){var g,h;
g=j.currentTarget;
h=$(g).val();
if(h&&this.match(h)){return this.trigger("match")
}};
f.prototype.match=function(g){return _.any(this._dictionary,function(h){return h.test(g)
})
};
return f
})()
},{}],88:[function(b,c,a){(function(g){var f,d=g();
g.fn.sortable=function(h){var j=String(h);
h=g.extend({connectWith:false},h);
return this.each(function(){if(/^enable|disable|destroy$/.test(j)){var k=g(this).children(g(this).data("items")).attr("draggable",j=="enable");
if(j=="destroy"){k.add(this).removeData("connectWith items").off("dragstart.h5s dragend.h5s selectstart.h5s dragover.h5s dragenter.h5s drop.h5s")
}return
}var m,l,k=g(this).children(h.items);
var n=g("<"+(/^ul|ol$/i.test(this.tagName)?"li":"div")+' class="sortable-placeholder">');
k.find(h.handle).mousedown(function(){m=true
}).mouseup(function(){m=false
});
g(this).data("items",h.items);
d=d.add(n);
if(h.connectWith){g(h.connectWith).add(this).data("connectWith",h.connectWith)
}k.attr("draggable","true").on("dragstart.h5s",function(p){if(h.handle&&!m){return false
}m=false;
var o=p.originalEvent.dataTransfer;
o.effectAllowed="move";
o.setData("Text","dummy");
l=(f=g(this)).addClass("sortable-dragging").index()
}).on("dragend.h5s",function(){if(!f){return
}f.removeClass("sortable-dragging").show();
d.detach();
if(l!=f.index()){f.parent().trigger("sortupdate",{item:f})
}f=null
}).not("a[href], img").on("selectstart.h5s",function(){this.dragDrop&&this.dragDrop();
return false
}).end().add([this,n]).on("dragover.h5s dragenter.h5s drop.h5s",function(o){if(!k.is(f)&&h.connectWith!==g(f).parent().data("connectWith")){return true
}if(o.type=="drop"){o.stopPropagation();
d.filter(":visible").after(f);
f.trigger("dragend.h5s");
return false
}o.preventDefault();
o.originalEvent.dataTransfer.dropEffect="move";
if(k.is(this)){if(h.forcePlaceholderSize){n.height(f.outerHeight())
}f.hide();
g(this)[n.index()<g(this).index()?"after":"before"](n);
d.not(n).detach()
}else{if(!d.is(this)&&!g(this).children(h.items).length){d.detach();
g(this).append(n)
}}return false
})
})
}
})(jQuery)
},{}],89:[function(b,c,a){(function(k,j,d,m){var l={bounds:true,country:null,map:false,details:false,detailsAttribute:"name",location:false,mapOptions:{zoom:14,scrollwheel:false,mapTypeId:"roadmap"},markerOptions:{draggable:false},maxZoom:16,types:["geocode"]};
var f=("street_address route intersection political country administrative_area_level_1 administrative_area_level_2 administrative_area_level_3 colloquial_area locality sublocality neighborhood premise subpremise postal_code natural_feature airport park point_of_interest post_box street_number floor room lat lng viewport location formatted_address location_type bounds").split(" ");
var h=("id url website vicinity reference name rating international_phone_number icon formatted_phone_number").split(" ");
function g(n,o){this.options=k.extend(true,{},l,o);
this.input=n;
this.$input=k(n);
this._defaults=l;
this._name="geocomplete";
this.init()
}k.extend(g.prototype,{init:function(){this.initMap();
this.initMarker();
this.initGeocoder();
this.initDetails();
this.initLocation()
},initMap:function(){if(!this.options.map){return
}if(typeof this.options.map.setCenter=="function"){this.map=this.options.map;
return
}this.map=new google.maps.Map(k(this.options.map)[0],this.options.mapOptions)
},initMarker:function(){if(!this.map){return
}var n=k.extend(this.options.markerOptions,{map:this.map});
if(n.disabled){return
}this.marker=new google.maps.Marker(n);
google.maps.event.addListener(this.marker,"dragend",k.proxy(this.markerDragged,this))
},initGeocoder:function(){var n={types:this.options.types,bounds:this.options.bounds===true?null:this.options.bounds,componentRestrictions:this.options.componentRestrictions};
if(this.options.country){n.componentRestrictions={country:this.options.country}
}this.autocomplete=new google.maps.places.Autocomplete(this.input,n);
this.geocoder=new google.maps.Geocoder();
if(this.map&&this.options.bounds===true){this.autocomplete.bindTo("bounds",this.map)
}google.maps.event.addListener(this.autocomplete,"place_changed",k.proxy(this.placeChanged,this));
this.$input.keypress(function(o){if(o.keyCode===13){return false
}});
this.$input.bind("geocode",k.proxy(function(){this.find()
},this))
},initDetails:function(){if(!this.options.details){return
}var n=k(this.options.details),q=this.options.detailsAttribute,o={};
function p(r){o[r]=n.find("["+q+"="+r+"]")
}k.each(f,function(r,s){p(s);
p(s+"_short")
});
k.each(h,function(r,s){p(s)
});
this.$details=n;
this.details=o
},initLocation:function(){var n=this.options.location,o;
if(!n){return
}if(typeof n=="string"){this.find(n);
return
}if(n instanceof Array){o=new google.maps.LatLng(n[0],n[1])
}if(n instanceof google.maps.LatLng){o=n
}if(o){if(this.map){this.map.setCenter(o)
}}},find:function(n){this.geocode({address:n||this.$input.val()})
},geocode:function(n){if(this.options.bounds&&!n.bounds){if(this.options.bounds===true){n.bounds=this.map&&this.map.getBounds()
}else{n.bounds=this.options.bounds
}}if(this.options.country){n.region=this.options.country
}this.geocoder.geocode(n,k.proxy(this.handleGeocode,this))
},handleGeocode:function(p,o){if(o===google.maps.GeocoderStatus.OK){var n=p[0];
this.$input.val(n.formatted_address);
this.update(n);
if(p.length>1){this.trigger("geocode:multiple",p)
}}else{this.trigger("geocode:error",o)
}},trigger:function(o,n){this.$input.trigger(o,[n])
},center:function(n){if(n.viewport){this.map.fitBounds(n.viewport);
if(this.map.getZoom()>this.options.maxZoom){this.map.setZoom(this.options.maxZoom)
}}else{this.map.setZoom(this.options.maxZoom);
this.map.setCenter(n.location)
}if(this.marker){this.marker.setPosition(n.location);
this.marker.setAnimation(this.options.markerOptions.animation)
}},update:function(n){if(this.map){this.center(n.geometry)
}if(this.$details){this.fillDetails(n)
}this.trigger("geocode:result",n)
},fillDetails:function(o){var q={},r=o.geometry,n=r.viewport,p=r.bounds;
k.each(o.address_components,function(v,u){var s=u.types[0];
q[s]=u.long_name;
q[s+"_short"]=u.short_name
});
k.each(h,function(s,u){q[u]=o[u]
});
k.extend(q,{formatted_address:o.formatted_address,location_type:r.location_type||"PLACES",viewport:n,bounds:p,location:r.location,lat:r.location.lat(),lng:r.location.lng()});
k.each(this.details,k.proxy(function(s,v){var u=q[s];
this.setDetail(v,u)
},this));
this.data=q
},setDetail:function(n,o){if(o===m){o=""
}else{if(typeof o.toUrlValue=="function"){o=o.toUrlValue()
}}if(n.is(":input")){n.val(o)
}else{n.text(o)
}},markerDragged:function(n){this.trigger("geocode:dragged",n.latLng)
},resetMarker:function(){this.marker.setPosition(this.data.location);
this.setDetail(this.details.lat,this.data.location.lat());
this.setDetail(this.details.lng,this.data.location.lng())
},placeChanged:function(){var n=this.autocomplete.getPlace();
if(!n.geometry){this.find(n.name)
}else{this.update(n)
}}});
k.fn.geocomplete=function(o){var p="plugin_geocomplete";
if(typeof o=="string"){var n=k(this).data(p)||k(this).geocomplete().data(p),q=n[o];
if(typeof q=="function"){q.apply(n,Array.prototype.slice.call(arguments,1));
return k(this)
}else{if(arguments.length==2){q=arguments[1]
}return q
}}else{return this.each(function(){var r=k.data(this,p);
if(!r){r=new g(this,o);
k.data(this,p,r)
}})
}}
})(jQuery,window,document)
},{}],90:[function(b,c,a){b("./jquery.sortable.js");
b("./input_keyword_scanner.coffee");
b("./lib/jquery/jquery.geocomplete.js");
b("./vendor/modifierKey.js");
b("./phone_number_verify_widget.js");
b("./plupload.full.js");
window.ManageListing={};
window.ManageListing.Application=b("./apps/manage_listing/application.coffee")
},{"./apps/manage_listing/application.coffee":1,"./input_keyword_scanner.coffee":87,"./jquery.sortable.js":88,"./lib/jquery/jquery.geocomplete.js":89,"./phone_number_verify_widget.js":92,"./plupload.full.js":93,"./vendor/modifierKey.js":94}],91:[function(f,g,b){var a,j,d=function(k,l){return function(){return k.apply(l,arguments)
}
},c={}.hasOwnProperty,h=function(n,l){for(var k in l){if(c.call(l,k)){n[k]=l[k]
}}function m(){this.constructor=n
}m.prototype=l.prototype;
n.prototype=new m();
n.__super__=l.prototype;
return n
};
this.AIR||(this.AIR={});
a=this.AIR;
a.Models||(a.Models={});
j=f("backbone");
a.Models.Base=(function(l){h(k,l);
function k(){this.data=d(this.data,this);
this.toJSON=d(this.toJSON,this);
return k.__super__.constructor.apply(this,arguments)
}k.prototype.toJSON=function(){var m;
if(this.jsonKey){m={};
m[this.jsonKey]=this.attributes;
return m
}else{return _.clone(this.attributes)
}};
k.prototype.data=function(){return _.clone(this.attributes)
};
k.prototype.fetch=function(n){var m,o;
if(n==null){n={}
}if(n.success){o=n.success
}m={success:function(p,q){if(o!=null){o.call(this,p,q)
}return p.trigger("fetched",true)
}};
_.extend(n,m);
return k.__super__.fetch.call(this,n)
};
k.prototype.parse=function(n,m){if(this.jsonKey){return n[this.jsonKey]
}else{return n
}};
return k
})(j.Model);
if(typeof g!=="undefined"&&g!==null){g.exports=a.Models.Base
}},{backbone:"backbone"}],92:[function(b,c,a){(function(f,g){var d=f.PhoneNumberVerifyWidget=function(h){this.init(h)
};
d.prototype={ajaxUrl:"/phone_numbers/phone_number_verify_widget",isColorbox:false,canCancelStepOne:true,finished:false,init:function(h){var k=this;
this.elements=g.extend({},{});
this.options=g.extend({},h||{});
if(h.ajax){if(!h.element){throw"Need to set options.element"
}var j=g(h.element).load(this.ajaxUrl,function(){k.element=j.find(".phone-number-verify-widget");
k.initCallback()
})
}else{if(h.element){this.element=g(h.element);
this.initCallback()
}else{this.isColorbox=true;
g.colorbox.loading();
g.get(this.ajaxUrl,function(l){g.colorbox({html:l});
k.element=g("#colorbox .phone-number-verify-widget");
k.initCallback()
})
}}},initCallback:function(){var h=this.$(".phone-number-input-widget");
this.$('.pnaw-verify-container a[rel="sms"], .pnaw-verify-container a[rel="call"]').click(this.proxy(this.stepOneHandler));
this.$('.pnaw-verify-container a[rel="verify"]').click(this.proxy(this.stepTwoHandler));
this.$('.pnaw-verify-container a[rel="cancel"]').click(this.proxy(this.cancelHandler));
this.$("#phone_number_verification").keypress(this.proxy(this.codeKeypressHandler));
this.phoneNumberInputWidget=h.data("phoneNumberInputWidget")||h.phoneNumberInputWidget().data("phoneNumberInputWidget");
if(this.options.country){this.setCountry(this.options.country)
}if(this.options.number){this.setNumber(this.options.number)
}if(!this.options.canCancelStepOne){this.$(".pnaw-step1 a.cancel").hide()
}if(this.options.phone_number_id){this.element.data("phone_number_id",this.options.phone_number_id)
}},setCountry:function(h){this.phoneNumberInputWidget.setCountry(h)
},setNumber:function(h){this.phoneNumberInputWidget.setNumber(h)
},getPrefix:function(){return this.phoneNumberInputWidget.getPrefix()
},getNumber:function(){return this.phoneNumberInputWidget.getNumber()
},getCountry:function(){return this.phoneNumberInputWidget.getCountry()
},codeKeypressHandler:function(j,k){var h=4;
if(k.which===13){this.$('.pnaw-verify-container a[rel="verify"]').click();
return false
}else{if(j.value.length>=h){j.value=j.value.substring(0,h);
return false
}}},cancelHandler:function(h,j){this.finish(false);
this.element.trigger("cancel")
},verifyNumber:function(l,o,j){var k=this,h="/phone_numbers/create",l=g.trim(l),n={phone_number:l,phone_type:j,phone_number_country:o,reservation:this.options.resoCode},m=g("body");
this.$(".message").html("");
this.setLoading(true);
m.trigger("phone_modal_event","phone_numbers#create_attempt");
this.stepOneXhr=g.post(h,n,function(p){k.setLoading(false);
if(p.result==="failure"){m.trigger("phone_modal_event","phone_numbers#create_legitimate_failure");
k.phoneNumberInputWidget.setError(true);
k.showError(p.message)
}else{m.trigger("phone_modal_event","phone_numbers#create_success");
k.stepTwo(j);
k.startPolling();
k.element.data("phone_number_id",p.phone_number_id);
k.setMessage(p.message)
}}).error(function(){m.trigger("phone_modal_event","phone_numbers#create_server_error");
k.setLoading(false);
k.phoneNumberInputWidget.setError(true)
})
},startPolling:function(){var h=this;
if(this.pollingTimer){clearInterval(this.pollingTimer)
}this.pollingTimer=setInterval(function(){g.get("/phone_numbers/verification_status",{id:h.element.data("phone_number_id")},function(j){if(j.status==="verified"){h.finish()
}})
},10000)
},stepOneHandler:function(j,l){var m=this.getPrefix()+"",k=this.getNumber()+"",h=g(j).attr("rel"),n=this.getCountry();
k=k.replace(/\D/g,"");
if(k.length<6){this.phoneNumberInputWidget.setError(true);
if(k.length>m.length){this.showError(I18n.t("phone_number_widget.number_too_short"))
}else{this.showError(I18n.t("phone_number_widget.please_enter_a_number"))
}}else{this.hideError();
this.verifyNumber(k,n,h)
}},stepTwoHandler:function(){var h="/phone_numbers/verify",k=this.$("#phone_number_verification").val().trim(),l={id:this.element.data("phone_number_id")||this.options.id,verification_code:k,reservation:this.options.resoCode},j=this;
k=k.replace(/\D/g,"");
if(!k){this.showError(I18n.t("phone_number_widget.verify_validation_error"))
}else{if(k.length!=4){this.showError(I18n.t("phone_number_widget.verification_code_four_digits"))
}else{this.hideError();
j.setLoading(true);
g.post(h,l,function(m){j.setLoading(false);
if(m.result==="success"){g("body").trigger("phone_modal_event","phone_numbers#verify success");
j.finish()
}else{j.$("#phone_number_verification").val("").animate({left:"-5px"},100,function(){g(this).animate({left:"5px"},100,function(){g(this).animate({left:0},100)
})
});
g("body").trigger("phone_modal_event","phone_numbers#verify error");
j.showError(m.error);
g("#phone-verification-modal").trigger("failure")
}})
}}},stepOne:function(){this.phoneNumberInputWidget.setNumber("");
this.$(".pnaw-step1").show();
this.$(".pnaw-step2").hide();
this.hideError()
},stepTwo:function(h){this.$("#phone_number_verification").val("");
this.$(".pnaw-step1").hide();
this.$(".pnaw-step2").fadeIn(200);
this.hideError();
this.$(".cancel-message").toggle(h==="sms")
},finish:function(h){this.hideError();
if(this.pollingTimer){clearInterval(this.pollingTimer)
}this.stepOne();
if(h!==false&&this.finished===false){if(this.options.onComplete){this.options.onComplete.call(this)
}this.element.trigger("complete");
g(document).trigger("phone_number_verify_widget.complete");
if(this.isColorbox){g.colorbox.close()
}this.finished=true
}},setLoading:function(h){if(h){this.element.addClass("loading")
}else{this.element.removeClass("loading")
}},showError:function(h){this.$(".pnaw-verification-error").text(h).fadeIn(200)
},hideError:function(){this.$(".pnaw-verification-error").hide()
},setMessage:function(h){this.element.find(".message").html(h)
},$:function(h,j){if(j||typeof this.elements[h]==="undefined"){this.elements[h]=this.element.find(h)
}return this.elements[h]
},proxy:function(j){var h=this;
return function(k){return j.call(h,this,k)
}
}};
g.fn.phoneNumberVerifyWidget=function(h){return this.each(function(j,l){var k=new d(g.extend({element:l},h));
return g(this).data("phoneNumberVerifyWidget",k)
})
};
g.phoneNumberVerifyWidget=function(h){return g("div.phone-number-verify-widget").phoneNumberVerifyWidget(h)
}
})(Airbnb,jQuery)
},{}],93:[function(b,c,a){(function(){var w=0,q=[],o={},s={},B={"<":"lt",">":"gt","&":"amp",'"':"quot","'":"#39"},p=/[<>&\"\']/g,A,z=window.setTimeout,y={},x;
function u(){this.returnValue=false
}function r(){this.cancelBubble=true
}(function(j){var h=j.split(/,/),g,d,f;
for(g=0;
g<h.length;
g+=2){f=h[g+1].split(/ /);
for(d=0;
d<f.length;
d++){s[f[d]]=h[g]
}}})("application/msword,doc dot,application/pdf,pdf,application/pgp-signature,pgp,application/postscript,ps ai eps,application/rtf,rtf,application/vnd.ms-excel,xls xlb,application/vnd.ms-powerpoint,ppt pps pot,application/zip,zip,application/x-shockwave-flash,swf swfl,application/vnd.openxmlformats-officedocument.wordprocessingml.document,docx,application/vnd.openxmlformats-officedocument.wordprocessingml.template,dotx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,xlsx,application/vnd.openxmlformats-officedocument.presentationml.presentation,pptx,application/vnd.openxmlformats-officedocument.presentationml.template,potx,application/vnd.openxmlformats-officedocument.presentationml.slideshow,ppsx,application/x-javascript,js,application/json,json,audio/mpeg,mpga mpega mp2 mp3,audio/x-wav,wav,audio/mp4,m4a,image/bmp,bmp,image/gif,gif,image/jpeg,jpeg jpg jpe,image/photoshop,psd,image/png,png,image/svg+xml,svg svgz,image/tiff,tiff tif,text/plain,asc txt text diff log,text/html,htm html xhtml,text/css,css,text/csv,csv,text/rtf,rtf,video/mpeg,mpeg mpg mpe m2v,video/quicktime,qt mov,video/mp4,mp4,video/x-m4v,m4v,video/x-flv,flv,video/x-ms-wmv,wmv,video/avi,avi,video/webm,webm,video/3gpp,3gp,video/3gpp2,3g2,video/vnd.rn-realvideo,rv,application/vnd.oasis.opendocument.formula-template,otf,application/octet-stream,exe");
var v={VERSION:"1.5.5",STOPPED:1,STARTED:2,QUEUED:1,UPLOADING:2,FAILED:4,DONE:5,GENERIC_ERROR:-100,HTTP_ERROR:-200,IO_ERROR:-300,SECURITY_ERROR:-400,INIT_ERROR:-500,FILE_SIZE_ERROR:-600,FILE_EXTENSION_ERROR:-601,IMAGE_FORMAT_ERROR:-700,IMAGE_MEMORY_ERROR:-701,IMAGE_DIMENSIONS_ERROR:-702,mimeTypes:s,ua:(function(){var f=navigator,g=f.userAgent,d=f.vendor,j,k,h;
j=/WebKit/.test(g);
h=j&&d.indexOf("Apple")!==-1;
k=window.opera&&window.opera.buildNumber;
return{windows:navigator.platform.indexOf("Win")!==-1,ie:!j&&!k&&(/MSIE/gi).test(g)&&(/Explorer/gi).test(f.appName),webkit:j,gecko:!j&&/Gecko/.test(g),safari:h,opera:!!k}
}()),typeOf:function(d){return({}).toString.call(d).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()
},extend:function(d){v.each(arguments,function(g,f){if(f>0){v.each(g,function(h,j){d[j]=h
})
}});
return d
},cleanName:function(g){var f,d;
d=[/[\300-\306]/g,"A",/[\340-\346]/g,"a",/\307/g,"C",/\347/g,"c",/[\310-\313]/g,"E",/[\350-\353]/g,"e",/[\314-\317]/g,"I",/[\354-\357]/g,"i",/\321/g,"N",/\361/g,"n",/[\322-\330]/g,"O",/[\362-\370]/g,"o",/[\331-\334]/g,"U",/[\371-\374]/g,"u"];
for(f=0;
f<d.length;
f+=2){g=g.replace(d[f],d[f+1])
}g=g.replace(/\s+/g,"_");
g=g.replace(/[^a-z0-9_\-\.]+/gi,"");
return g
},addRuntime:function(f,d){d.name=f;
q[f]=d;
q.push(d);
return d
},guid:function(){var f=new Date().getTime().toString(32),d;
for(d=0;
d<5;
d++){f+=Math.floor(Math.random()*65535).toString(32)
}return(v.guidPrefix||"p")+f+(w++).toString(32)
},buildUrl:function(f,g){var d="";
v.each(g,function(h,j){d+=(d?"&":"")+encodeURIComponent(j)+"="+encodeURIComponent(h)
});
if(d){f+=(f.indexOf("?")>0?"&":"?")+d
}return f
},each:function(f,d){var g,h,j;
if(f){g=f.length;
if(g===A){for(h in f){if(f.hasOwnProperty(h)){if(d(f[h],h)===false){return
}}}}else{for(j=0;
j<g;
j++){if(d(f[j],j)===false){return
}}}}},formatSize:function(d){if(d===A||/\D/.test(d)){return v.translate("N/A")
}if(d>1073741824){return Math.round(d/1073741824,1)+" GB"
}if(d>1048576){return Math.round(d/1048576,1)+" MB"
}if(d>1024){return Math.round(d/1024,1)+" KB"
}return d+" b"
},getPos:function(g,m){var l=0,n=0,j,k=document,f,d;
g=g;
m=m||k.body;
function h(H){var E,I,G=0,F=0;
if(H){I=H.getBoundingClientRect();
E=k.compatMode==="CSS1Compat"?k.documentElement:k.body;
G=I.left+E.scrollLeft;
F=I.top+E.scrollTop
}return{x:G,y:F}
}if(g&&g.getBoundingClientRect&&((navigator.userAgent.indexOf("MSIE")>0)&&(k.documentMode<8))){f=h(g);
d=h(m);
return{x:f.x-d.x,y:f.y-d.y}
}j=g;
while(j&&j!=m&&j.nodeType){l+=j.offsetLeft||0;
n+=j.offsetTop||0;
j=j.offsetParent
}j=g.parentNode;
while(j&&j!=m&&j.nodeType){l-=j.scrollLeft||0;
n-=j.scrollTop||0;
j=j.parentNode
}return{x:l,y:n}
},getSize:function(d){return{w:d.offsetWidth||d.clientWidth,h:d.offsetHeight||d.clientHeight}
},parseSize:function(f){var d;
if(typeof(f)=="string"){f=/^([0-9]+)([mgk]?)$/.exec(f.toLowerCase().replace(/[^0-9mkg]/g,""));
d=f[2];
f=+f[1];
if(d=="g"){f*=1073741824
}if(d=="m"){f*=1048576
}if(d=="k"){f*=1024
}}return f
},xmlEncode:function(d){return d?(""+d).replace(p,function(f){return B[f]?"&"+B[f]+";":f
}):d
},toArray:function(d){var f,g=[];
for(f=0;
f<d.length;
f++){g[f]=d[f]
}return g
},inArray:function(f,d){if(d){if(Array.prototype.indexOf){return Array.prototype.indexOf.call(d,f)
}for(var h=0,g=d.length;
h<g;
h++){if(d[h]===f){return h
}}}return -1
},addI18n:function(d){return v.extend(o,d)
},translate:function(d){return o[d]||d
},isEmptyObj:function(f){if(f===A){return true
}for(var d in f){return false
}return true
},hasClass:function(d,f){var g;
if(d.className==""){return false
}g=new RegExp("(^|\\s+)"+f+"(\\s+|$)");
return g.test(d.className)
},addClass:function(d,f){if(!v.hasClass(d,f)){d.className=d.className==""?f:d.className.replace(/\s+$/,"")+" "+f
}},removeClass:function(d,f){var g=new RegExp("(^|\\s+)"+f+"(\\s+|$)");
d.className=d.className.replace(g,function(j,k,h){return k===" "&&h===" "?" ":""
})
},getStyle:function(d,f){if(d.currentStyle){return d.currentStyle[f]
}else{if(window.getComputedStyle){return window.getComputedStyle(d,null)[f]
}}},addEvent:function(f,l,d){var g,h,j,k;
k=arguments[3];
l=l.toLowerCase();
if(x===A){x="Plupload_"+v.guid()
}if(f.addEventListener){g=d;
f.addEventListener(l,g,false)
}else{if(f.attachEvent){g=function(){var m=window.event;
if(!m.target){m.target=m.srcElement
}m.preventDefault=u;
m.stopPropagation=r;
d(m)
};
f.attachEvent("on"+l,g)
}}if(f[x]===A){f[x]=v.guid()
}if(!y.hasOwnProperty(f[x])){y[f[x]]={}
}h=y[f[x]];
if(!h.hasOwnProperty(l)){h[l]=[]
}h[l].push({func:g,orig:d,key:k})
},removeEvent:function(f,l){var h,d,j;
if(typeof(arguments[2])=="function"){d=arguments[2]
}else{j=arguments[2]
}l=l.toLowerCase();
if(f[x]&&y[f[x]]&&y[f[x]][l]){h=y[f[x]][l]
}else{return
}for(var k=h.length-1;
k>=0;
k--){if(h[k].key===j||h[k].orig===d){if(f.removeEventListener){f.removeEventListener(l,h[k].func,false)
}else{if(f.detachEvent){f.detachEvent("on"+l,h[k].func)
}}h[k].orig=null;
h[k].func=null;
h.splice(k,1);
if(d!==A){break
}}}if(!h.length){delete y[f[x]][l]
}if(v.isEmptyObj(y[f[x]])){delete y[f[x]];
try{delete f[x]
}catch(g){f[x]=A
}}},removeAllEvents:function(d){var f=arguments[1];
if(d[x]===A||!d[x]){return
}v.each(y[d[x]],function(g,h){v.removeEvent(d,h,f)
})
}};
v.Uploader=function(h){var l={},d,f=[],j,k=false;
d=new v.QueueProgress();
h=v.extend({chunk_size:0,multipart:true,multi_selection:true,file_data_name:"file",filters:[]},h);
function g(){var n,D=0,C;
if(this.state==v.STARTED){for(C=0;
C<f.length;
C++){if(!n&&f[C].status==v.QUEUED){n=f[C];
n.status=v.UPLOADING;
if(this.trigger("BeforeUpload",n)){this.trigger("UploadFile",n)
}}else{D++
}}if(D==f.length){this.stop();
this.trigger("UploadComplete",f)
}}}function m(){var n,C;
d.reset();
for(n=0;
n<f.length;
n++){C=f[n];
if(C.size!==A){d.size+=C.size;
d.loaded+=C.loaded
}else{d.size=A
}if(C.status==v.DONE){d.uploaded++
}else{if(C.status==v.FAILED){d.failed++
}else{d.queued++
}}}if(d.size===A){d.percent=f.length>0?Math.ceil(d.uploaded/f.length*100):0
}else{d.bytesPerSec=Math.ceil(d.loaded/((+new Date()-j||1)/1000));
d.percent=d.size>0?Math.ceil(d.loaded/d.size*100):0
}}v.extend(this,{state:v.STOPPED,runtime:"",features:{},files:f,settings:h,total:d,id:v.guid(),init:function(){var I=this,G,H,D,n=0,F;
if(typeof(h.preinit)=="function"){h.preinit(I)
}else{v.each(h.preinit,function(C,J){I.bind(J,C)
})
}h.page_url=h.page_url||document.location.pathname.replace(/\/[^\/]+$/g,"/");
if(!/^(\w+:\/\/|\/)/.test(h.url)){h.url=h.page_url+h.url
}h.chunk_size=v.parseSize(h.chunk_size);
h.max_file_size=v.parseSize(h.max_file_size);
I.bind("FilesAdded",function(P,M){var N,O,K=0,C,L=h.filters;
if(L&&L.length){C=[];
v.each(L,function(J){v.each(J.extensions.split(/,/),function(Q){if(/^\s*\*\s*$/.test(Q)){C.push("\\.*")
}else{C.push("\\."+Q.replace(new RegExp("["+("/^$.*+?|()[]{}\\".replace(/./g,"\\$&"))+"]","g"),"\\$&"))
}})
});
C=new RegExp(C.join("|")+"$","i")
}for(N=0;
N<M.length;
N++){O=M[N];
O.loaded=0;
O.percent=0;
O.status=v.QUEUED;
if(C&&!C.test(O.name)){P.trigger("Error",{code:v.FILE_EXTENSION_ERROR,message:v.translate("File extension error."),file:O});
continue
}if(O.size!==A&&O.size>h.max_file_size){P.trigger("Error",{code:v.FILE_SIZE_ERROR,message:v.translate("File size error."),file:O});
continue
}f.push(O);
K++
}if(K){z(function(){I.trigger("QueueChanged");
I.refresh()
},1)
}else{return false
}});
if(h.unique_names){I.bind("UploadFile",function(L,K){var C=K.name.match(/\.([^.]+)$/),J="tmp";
if(C){J=C[1]
}K.target_name=K.id+"."+J
})
}I.bind("UploadProgress",function(J,C){C.percent=C.size>0?Math.ceil(C.loaded/C.size*100):100;
m()
});
I.bind("StateChanged",function(C){if(C.state==v.STARTED){j=(+new Date())
}else{if(C.state==v.STOPPED){for(G=C.files.length-1;
G>=0;
G--){if(C.files[G].status==v.UPLOADING){C.files[G].status=v.QUEUED;
m()
}}}}});
I.bind("QueueChanged",m);
I.bind("Error",function(J,C){if(C.file){C.file.status=v.FAILED;
m();
if(J.state==v.STARTED){z(function(){g.call(I)
},1)
}}});
I.bind("FileUploaded",function(J,C){C.status=v.DONE;
C.loaded=C.size;
J.trigger("UploadProgress",C);
z(function(){g.call(I)
},1)
});
if(h.runtimes){H=[];
F=h.runtimes.split(/\s?,\s?/);
for(G=0;
G<F.length;
G++){if(q[F[G]]){H.push(q[F[G]])
}}}else{H=q
}function E(){var C=H[n++],J,L,K;
if(C){J=C.getFeatures();
L=I.settings.required_features;
if(L){L=L.split(",");
for(K=0;
K<L.length;
K++){if(!J[L[K]]){E();
return
}}}C.init(I,function(M){if(M&&M.success){I.features=J;
I.runtime=C.name;
I.trigger("Init",{runtime:C.name});
I.trigger("PostInit");
I.refresh()
}else{E()
}})
}else{I.trigger("Error",{code:v.INIT_ERROR,message:v.translate("Init error.")})
}}E();
if(typeof(h.init)=="function"){h.init(I)
}else{v.each(h.init,function(C,J){I.bind(J,C)
})
}},refresh:function(){this.trigger("Refresh")
},start:function(){if(f.length&&this.state!=v.STARTED){this.state=v.STARTED;
this.trigger("StateChanged");
g.call(this)
}},stop:function(){if(this.state!=v.STOPPED){this.state=v.STOPPED;
this.trigger("CancelUpload");
this.trigger("StateChanged")
}},disableBrowse:function(){k=arguments[0]!==A?arguments[0]:true;
this.trigger("DisableBrowse",k)
},getFile:function(n){var C;
for(C=f.length-1;
C>=0;
C--){if(f[C].id===n){return f[C]
}}},removeFile:function(n){var C;
for(C=f.length-1;
C>=0;
C--){if(f[C].id===n.id){return this.splice(C,1)[0]
}}},splice:function(D,C){var n;
n=f.splice(D===A?0:D,C===A?f.length:C);
this.trigger("FilesRemoved",n);
this.trigger("QueueChanged");
return n
},trigger:function(n){var D=l[n.toLowerCase()],E,C;
if(D){C=Array.prototype.slice.call(arguments);
C[0]=this;
for(E=0;
E<D.length;
E++){if(D[E].func.apply(D[E].scope,C)===false){return false
}}}return true
},hasEventListener:function(n){return !!l[n.toLowerCase()]
},bind:function(C,E,n){var D;
C=C.toLowerCase();
D=l[C]||[];
D.push({func:E,scope:n||this});
l[C]=D
},unbind:function(C){C=C.toLowerCase();
var D=l[C],n,E=arguments[1];
if(D){if(E!==A){for(n=D.length-1;
n>=0;
n--){if(D[n].func===E){D.splice(n,1);
break
}}}else{D=[]
}if(!D.length){delete l[C]
}}},unbindAll:function(){var n=this;
v.each(l,function(D,C){n.unbind(C)
})
},destroy:function(){this.stop();
this.trigger("Destroy");
this.unbindAll()
}})
};
v.File=function(d,g,f){var h=this;
h.id=d;
h.name=g;
h.size=f;
h.loaded=0;
h.percent=0;
h.status=0
};
v.Runtime=function(){this.getFeatures=function(){};
this.init=function(f,d){}
};
v.QueueProgress=function(){var d=this;
d.size=0;
d.loaded=0;
d.uploaded=0;
d.failed=0;
d.queued=0;
d.percent=0;
d.bytesPerSec=0;
d.reset=function(){d.size=d.loaded=d.uploaded=d.failed=d.queued=d.percent=d.bytesPerSec=0
}
};
v.runtimes={};
window.plupload=v
})();
(function(){if(window.google&&google.gears){return
}var f=null;
if(typeof GearsFactory!="undefined"){f=new GearsFactory()
}else{try{f=new ActiveXObject("Gears.Factory");
if(f.getBuildInfo().indexOf("ie_mobile")!=-1){f.privateSetGlobalObject(this)
}}catch(d){if((typeof navigator.mimeTypes!="undefined")&&navigator.mimeTypes["application/x-googlegears"]){f=document.createElement("object");
f.style.display="none";
f.width=0;
f.height=0;
f.type="application/x-googlegears";
document.documentElement.appendChild(f)
}}}if(!f){return
}if(!window.google){window.google={}
}if(!google.gears){google.gears={factory:f}
}})();
(function(k,g,m,l){var j={};
function h(r,p,d){var s,q,f,u;
q=google.gears.factory.create("beta.canvas");
try{q.decode(r);
if(!p.width){p.width=q.width
}if(!p.height){p.height=q.height
}u=Math.min(p.width/q.width,p.height/q.height);
if(u<1){q.resize(Math.round(q.width*u),Math.round(q.height*u))
}else{if(!p.quality||d!=="image/jpeg"){return r
}}if(p.quality){return q.encode(d,{quality:p.quality/100})
}return q.encode(d)
}catch(v){}return r
}m.runtimes.Gears=m.addRuntime("gears",{getFeatures:function(){return{dragdrop:true,jpgresize:true,pngresize:true,chunks:true,progress:true,multipart:true,multi_selection:true}
},init:function(f,s){var d,q,r=false;
if(!k.google||!google.gears){return s({success:false})
}try{d=google.gears.factory.create("beta.desktop")
}catch(o){return s({success:false})
}function p(v){var w,x,u=[],n;
for(x=0;
x<v.length;
x++){w=v[x];
n=m.guid();
j[n]=w.blob;
u.push(new m.File(n,w.name,w.blob.length))
}f.trigger("FilesAdded",u)
}f.bind("PostInit",function(){var n=f.settings,u=g.getElementById(n.drop_element);
if(u){m.addEvent(u,"dragover",function(v){d.setDropEffect(v,"copy");
v.preventDefault()
},f.id);
m.addEvent(u,"drop",function(v){var w=d.getDragData(v,"application/x-gears-files");
if(w){p(w.files)
}v.preventDefault()
},f.id);
u=0
}m.addEvent(g.getElementById(n.browse_button),"click",function(v){var w=[],y,z,x;
v.preventDefault();
if(r){return
}no_type_restriction:for(y=0;
y<n.filters.length;
y++){x=n.filters[y].extensions.split(",");
for(z=0;
z<x.length;
z++){if(x[z]==="*"){w=[];
break no_type_restriction
}w.push("."+x[z])
}}d.openFiles(p,{singleFile:!n.multi_selection,filter:w})
},f.id)
});
f.bind("CancelUpload",function(){if(q.abort){q.abort()
}});
f.bind("UploadFile",function(C,n){var A=0,B,E,D=0,x=C.settings.resize,z;
if(x&&/\.(png|jpg|jpeg)$/i.test(n.name)){j[n.id]=h(j[n.id],x,/\.png$/i.test(n.name)?"image/png":"image/jpeg")
}n.size=j[n.id].length;
E=C.settings.chunk_size;
z=E>0;
B=Math.ceil(n.size/E);
if(!z){E=n.size;
B=1
}function y(){var F,H=C.settings.multipart,v=0,G={name:n.target_name||n.name},w=C.settings.url;
function u(P){var Q,K="----pluploadboundary"+m.guid(),N="--",L="\r\n",O,M;
if(H){q.setRequestHeader("Content-Type","multipart/form-data; boundary="+K);
Q=google.gears.factory.create("beta.blobbuilder");
m.each(m.extend(G,C.settings.multipart_params),function(I,J){Q.append(N+K+L+'Content-Disposition: form-data; name="'+J+'"'+L+L);
Q.append(I+L)
});
M=m.mimeTypes[n.name.replace(/^.+\.([^.]+)/,"$1").toLowerCase()]||"application/octet-stream";
Q.append(N+K+L+'Content-Disposition: form-data; name="'+C.settings.file_data_name+'"; filename="'+n.name+'"'+L+"Content-Type: "+M+L+L);
Q.append(P);
Q.append(L+N+K+N+L);
O=Q.getAsBlob();
v=O.length-P.length;
P=O
}q.send(P)
}if(n.status==m.DONE||n.status==m.FAILED||C.state==m.STOPPED){return
}if(z){G.chunk=A;
G.chunks=B
}F=Math.min(E,n.size-(A*E));
if(!H){w=m.buildUrl(C.settings.url,G)
}q=google.gears.factory.create("beta.httprequest");
q.open("POST",w);
if(!H){q.setRequestHeader("Content-Disposition",'attachment; filename="'+n.name+'"');
q.setRequestHeader("Content-Type","application/octet-stream")
}m.each(C.settings.headers,function(I,J){q.setRequestHeader(J,I)
});
q.upload.onprogress=function(I){n.loaded=D+I.loaded-v;
C.trigger("UploadProgress",n)
};
q.onreadystatechange=function(){var I;
if(q.readyState==4&&C.state!==m.STOPPED){if(q.status==200){I={chunk:A,chunks:B,response:q.responseText,status:q.status};
C.trigger("ChunkUploaded",n,I);
if(I.cancelled){n.status=m.FAILED;
return
}D+=F;
if(++A>=B){n.status=m.DONE;
C.trigger("FileUploaded",n,{response:q.responseText,status:q.status})
}else{y()
}}else{C.trigger("Error",{code:m.HTTP_ERROR,message:m.translate("HTTP Error."),file:n,chunk:A,chunks:B,status:q.status})
}}};
if(A<B){u(j[n.id].slice(A*E,F))
}}y()
});
f.bind("DisableBrowse",function(u,n){r=n
});
f.bind("Destroy",function(w){var v,u,n={browseButton:w.settings.browse_button,dropElm:w.settings.drop_element};
for(v in n){u=g.getElementById(n[v]);
if(u){m.removeAllEvents(u,w.id)
}}});
s({success:true})
}})
})(window,document,plupload);
(function(m,j,p,o){var k={},l={};
function q(r){var s,d=typeof r,h,f,g;
if(r===o||r===null){return"null"
}if(d==="string"){s="\bb\tt\nn\ff\rr\"\"''\\\\";
return'"'+r.replace(/([\u0080-\uFFFF\x00-\x1f\"])/g,function(u,v){var w=s.indexOf(v);
if(w+1){return"\\"+s.charAt(w+1)
}u=v.charCodeAt().toString(16);
return"\\u"+"0000".substring(u.length)+u
})+'"'
}if(d=="object"){h=r.length!==o;
s="";
if(h){for(f=0;
f<r.length;
f++){if(s){s+=","
}s+=q(r[f])
}s="["+s+"]"
}else{for(g in r){if(r.hasOwnProperty(g)){if(s){s+=","
}s+=q(g)+":"+q(r[g])
}}s="{"+s+"}"
}return s
}return""+r
}function n(E){var B=false,A=null,h=null,z,y,x,C,w,f=0;
try{try{h=new ActiveXObject("AgControl.AgControl");
if(h.IsVersionSupported(E)){B=true
}h=null
}catch(d){var g=navigator.plugins["Silverlight Plug-In"];
if(g){z=g.description;
if(z==="1.0.30226.2"){z="2.0.30226.2"
}y=z.split(".");
while(y.length>3){y.pop()
}while(y.length<4){y.push(0)
}x=E.split(".");
while(x.length>4){x.pop()
}do{C=parseInt(x[f],10);
w=parseInt(y[f],10);
f++
}while(f<x.length&&C===w);
if(C<=w&&!isNaN(C)){B=true
}}}}catch(D){B=false
}return B
}p.silverlight={trigger:function(r,g){var d=k[r],f,h;
if(d){h=p.toArray(arguments).slice(1);
h[0]="Silverlight:"+g;
setTimeout(function(){d.trigger.apply(d,h)
},0)
}}};
p.runtimes.Silverlight=p.addRuntime("silverlight",{getFeatures:function(){return{jpgresize:true,pngresize:true,chunks:true,progress:true,multipart:true,multi_selection:true}
},init:function(s,r){var u,d="",v=s.settings.filters,f,g=j.body;
if(!n("2.0.31005.0")||(m.opera&&m.opera.buildNumber)){r({success:false});
return
}l[s.id]=false;
k[s.id]=s;
u=j.createElement("div");
u.id=s.id+"_silverlight_container";
p.extend(u.style,{position:"absolute",top:"0px",background:s.settings.shim_bgcolor||"transparent",zIndex:99999,width:"100px",height:"100px",overflow:"hidden",opacity:s.settings.shim_bgcolor||j.documentMode>8?"":0.01});
u.className="plupload silverlight";
if(s.settings.container){g=j.getElementById(s.settings.container);
if(p.getStyle(g,"position")==="static"){g.style.position="relative"
}}g.appendChild(u);
for(f=0;
f<v.length;
f++){d+=(d!=""?"|":"")+v[f].title+" | *."+v[f].extensions.replace(/,/g,";*.")
}u.innerHTML='<object id="'+s.id+'_silverlight" data="data:application/x-silverlight," type="application/x-silverlight-2" style="outline:none;" width="1024" height="1024"><param name="source" value="'+s.settings.silverlight_xap_url+'"/><param name="background" value="Transparent"/><param name="windowless" value="true"/><param name="enablehtmlaccess" value="true"/><param name="initParams" value="id='+s.id+",filter="+d+",multiselect="+s.settings.multi_selection+'"/></object>';
function h(){return j.getElementById(s.id+"_silverlight").content.Upload
}s.bind("Silverlight:Init",function(){var x,w={};
if(l[s.id]){return
}l[s.id]=true;
s.bind("Silverlight:StartSelectFiles",function(y){x=[]
});
s.bind("Silverlight:SelectFile",function(C,z,B,A){var y;
y=p.guid();
w[y]=z;
w[z]=y;
x.push(new p.File(y,B,A))
});
s.bind("Silverlight:SelectSuccessful",function(){if(x.length){s.trigger("FilesAdded",x)
}});
s.bind("Silverlight:UploadChunkError",function(C,z,B,y,A){s.trigger("Error",{code:p.IO_ERROR,message:"IO Error.",details:A,file:C.getFile(w[z])})
});
s.bind("Silverlight:UploadFileProgress",function(C,y,B,z){var A=C.getFile(w[y]);
if(A.status!=p.FAILED){A.size=z;
A.loaded=B;
C.trigger("UploadProgress",A)
}});
s.bind("Refresh",function(B){var A,z,y;
A=j.getElementById(B.settings.browse_button);
if(A){z=p.getPos(A,j.getElementById(B.settings.container));
y=p.getSize(A);
p.extend(j.getElementById(B.id+"_silverlight_container").style,{top:z.y+"px",left:z.x+"px",width:y.w+"px",height:y.h+"px"})
}});
s.bind("Silverlight:UploadChunkSuccessful",function(E,B,D,F,G){var A,C=E.getFile(w[B]);
A={chunk:D,chunks:F,response:G};
E.trigger("ChunkUploaded",C,A);
if(C.status!=p.FAILED&&E.state!==p.STOPPED){h().UploadNextChunk()
}if(D==F-1){C.status=p.DONE;
E.trigger("FileUploaded",C,{response:G})
}});
s.bind("Silverlight:UploadSuccessful",function(B,y,A){var z=B.getFile(w[y]);
z.status=p.DONE;
B.trigger("FileUploaded",z,{response:A})
});
s.bind("FilesRemoved",function(A,y){var z;
for(z=0;
z<y.length;
z++){h().RemoveFile(w[y[z].id])
}});
s.bind("UploadFile",function(B,z){var y=B.settings,A=y.resize||{};
h().UploadFile(w[z.id],B.settings.url,q({name:z.target_name||z.name,mime:p.mimeTypes[z.name.replace(/^.+\.([^.]+)/,"$1").toLowerCase()]||"application/octet-stream",chunk_size:y.chunk_size,image_width:A.width,image_height:A.height,image_quality:A.quality,multipart:!!y.multipart,multipart_params:y.multipart_params||{},file_data_name:y.file_data_name,headers:y.headers}))
});
s.bind("CancelUpload",function(){h().CancelUpload()
});
s.bind("Silverlight:MouseEnter",function(A){var z,y;
z=j.getElementById(s.settings.browse_button);
y=A.settings.browse_button_hover;
if(z&&y){p.addClass(z,y)
}});
s.bind("Silverlight:MouseLeave",function(A){var z,y;
z=j.getElementById(s.settings.browse_button);
y=A.settings.browse_button_hover;
if(z&&y){p.removeClass(z,y)
}});
s.bind("Silverlight:MouseLeftButtonDown",function(A){var z,y;
z=j.getElementById(s.settings.browse_button);
y=A.settings.browse_button_active;
if(z&&y){p.addClass(z,y);
p.addEvent(j.body,"mouseup",function(){p.removeClass(z,y)
})
}});
s.bind("Sliverlight:StartSelectFiles",function(A){var z,y;
z=j.getElementById(s.settings.browse_button);
y=A.settings.browse_button_active;
if(z&&y){p.removeClass(z,y)
}});
s.bind("DisableBrowse",function(z,y){h().DisableBrowse(y)
});
s.bind("Destroy",function(z){var y;
p.removeAllEvents(j.body,z.id);
delete l[z.id];
delete k[z.id];
y=j.getElementById(z.id+"_silverlight_container");
if(y){g.removeChild(y)
}});
r({success:true})
})
}})
})(window,document,plupload);
(function(l,h,n,m){var j={},k={};
function o(){var g;
try{g=navigator.plugins["Shockwave Flash"];
g=g.description
}catch(d){try{g=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")
}catch(f){g="0.0"
}}g=g.match(/\d+/g);
return parseFloat(g[0]+"."+g[1])
}n.flash={trigger:function(d,g,f){setTimeout(function(){var r=j[d],p,q;
if(r){r.trigger("Flash:"+g,f)
}},0)
}};
n.runtimes.Flash=n.addRuntime("flash",{getFeatures:function(){return{jpgresize:true,pngresize:true,maxWidth:8091,maxHeight:8091,chunks:true,progress:true,multipart:true,multi_selection:true}
},init:function(v,s){var f,d,r=0,q=h.body;
if(o()<10){s({success:false});
return
}k[v.id]=false;
j[v.id]=v;
f=h.getElementById(v.settings.browse_button);
d=h.createElement("div");
d.id=v.id+"_flash_container";
n.extend(d.style,{position:"absolute",top:"0px",background:v.settings.shim_bgcolor||"transparent",zIndex:99999,width:"100%",height:"100%"});
d.className="plupload flash";
if(v.settings.container){q=h.getElementById(v.settings.container);
if(n.getStyle(q,"position")==="static"){q.style.position="relative"
}}q.appendChild(d);
(function(){var w,p;
w='<object id="'+v.id+'_flash" type="application/x-shockwave-flash" data="'+v.settings.flash_swf_url+'" ';
if(n.ua.ie){w+='classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '
}w+='width="100%" height="100%" style="outline:0"><param name="movie" value="'+v.settings.flash_swf_url+'" /><param name="flashvars" value="id='+escape(v.id)+'" /><param name="wmode" value="transparent" /><param name="allowscriptaccess" value="always" /></object>';
if(n.ua.ie){p=h.createElement("div");
d.appendChild(p);
p.outerHTML=w;
p=null
}else{d.innerHTML=w
}}());
function u(){return h.getElementById(v.id+"_flash")
}function g(){if(r++>5000){s({success:false});
return
}if(k[v.id]===false){setTimeout(g,1)
}}g();
f=d=null;
v.bind("Destroy",function(w){var p;
n.removeAllEvents(h.body,w.id);
delete k[w.id];
delete j[w.id];
p=h.getElementById(w.id+"_flash_container");
if(p){q.removeChild(p)
}});
v.bind("Flash:Init",function(){var p={},w;
try{u().setFileFilters(v.settings.filters,v.settings.multi_selection)
}catch(x){s({success:false});
return
}if(k[v.id]){return
}k[v.id]=true;
v.bind("UploadFile",function(B,z){var y=B.settings,A=v.settings.resize||{};
u().uploadFile(p[z.id],y.url,{name:z.target_name||z.name,mime:n.mimeTypes[z.name.replace(/^.+\.([^.]+)/,"$1").toLowerCase()]||"application/octet-stream",chunk_size:y.chunk_size,width:A.width,height:A.height,quality:A.quality,multipart:y.multipart,multipart_params:y.multipart_params||{},file_data_name:y.file_data_name,format:/\.(jpg|jpeg)$/i.test(z.name)?"jpg":"png",headers:y.headers,urlstream_upload:y.urlstream_upload})
});
v.bind("CancelUpload",function(){u().cancelUpload()
});
v.bind("Flash:UploadProcess",function(z,A){var y=z.getFile(p[A.id]);
if(y.status!=n.FAILED){y.loaded=A.loaded;
y.size=A.size;
z.trigger("UploadProgress",y)
}});
v.bind("Flash:UploadChunkComplete",function(B,z){var y,A=B.getFile(p[z.id]);
y={chunk:z.chunk,chunks:z.chunks,response:z.text};
B.trigger("ChunkUploaded",A,y);
if(A.status!==n.FAILED&&B.state!==n.STOPPED){u().uploadNextChunk()
}if(z.chunk==z.chunks-1){A.status=n.DONE;
B.trigger("FileUploaded",A,{response:z.text})
}});
v.bind("Flash:SelectFiles",function(D,A){var B,C,z=[],E;
for(C=0;
C<A.length;
C++){B=A[C];
E=n.guid();
p[E]=B.id;
p[B.id]=E;
z.push(new n.File(E,B.name,B.size))
}if(z.length){v.trigger("FilesAdded",z)
}});
v.bind("Flash:SecurityError",function(z,y){v.trigger("Error",{code:n.SECURITY_ERROR,message:n.translate("Security error."),details:y.message,file:v.getFile(p[y.id])})
});
v.bind("Flash:GenericError",function(z,y){v.trigger("Error",{code:n.GENERIC_ERROR,message:n.translate("Generic error."),details:y.message,file:v.getFile(p[y.id])})
});
v.bind("Flash:IOError",function(z,y){v.trigger("Error",{code:n.IO_ERROR,message:n.translate("IO error."),details:y.message,file:v.getFile(p[y.id])})
});
v.bind("Flash:ImageError",function(z,y){v.trigger("Error",{code:parseInt(y.code,10),message:n.translate("Image error."),file:v.getFile(p[y.id])})
});
v.bind("Flash:StageEvent:rollOver",function(A){var z,y;
z=h.getElementById(v.settings.browse_button);
y=A.settings.browse_button_hover;
if(z&&y){n.addClass(z,y)
}});
v.bind("Flash:StageEvent:rollOut",function(A){var z,y;
z=h.getElementById(v.settings.browse_button);
y=A.settings.browse_button_hover;
if(z&&y){n.removeClass(z,y)
}});
v.bind("Flash:StageEvent:mouseDown",function(A){var z,y;
z=h.getElementById(v.settings.browse_button);
y=A.settings.browse_button_active;
if(z&&y){n.addClass(z,y);
n.addEvent(h.body,"mouseup",function(){n.removeClass(z,y)
},A.id)
}});
v.bind("Flash:StageEvent:mouseUp",function(A){var z,y;
z=h.getElementById(v.settings.browse_button);
y=A.settings.browse_button_active;
if(z&&y){n.removeClass(z,y)
}});
v.bind("Flash:ExifData",function(z,y){v.trigger("ExifData",v.getFile(p[y.id]),y.data)
});
v.bind("Flash:GpsData",function(z,y){v.trigger("GpsData",v.getFile(p[y.id]),y.data)
});
v.bind("QueueChanged",function(y){v.refresh()
});
v.bind("FilesRemoved",function(A,y){var z;
for(z=0;
z<y.length;
z++){u().removeFile(p[y[z].id])
}});
v.bind("StateChanged",function(y){v.refresh()
});
v.bind("Refresh",function(B){var A,z,y;
u().setFileFilters(v.settings.filters,v.settings.multi_selection);
A=h.getElementById(B.settings.browse_button);
if(A){z=n.getPos(A,h.getElementById(B.settings.container));
y=n.getSize(A);
n.extend(h.getElementById(B.id+"_flash_container").style,{top:z.y+"px",left:z.x+"px",width:y.w+"px",height:y.h+"px"})
}});
v.bind("DisableBrowse",function(z,y){u().disableBrowse(y)
});
s({success:true})
})
}})
})(window,document,plupload);
(function(d){d.runtimes.BrowserPlus=d.addRuntime("browserplus",{getFeatures:function(){return{dragdrop:true,jpgresize:true,pngresize:true,chunks:true,progress:true,multipart:true,multi_selection:true}
},init:function(n,l){var p=window.BrowserPlus,m={},q=n.settings,r=q.resize;
function o(s){var u,f,h=[],g,j;
for(f=0;
f<s.length;
f++){g=s[f];
j=d.guid();
m[j]=g;
h.push(new d.File(j,g.name,g.size))
}if(f){n.trigger("FilesAdded",h)
}}function k(){var f=false;
n.bind("PostInit",function(){var v,g=q.drop_element,s=n.id+"_droptarget",h=document.getElementById(g),w;
function j(x,y){p.DragAndDrop.AddDropTarget({id:x},function(z){p.DragAndDrop.AttachCallbacks({id:x,hover:function(A){if(!A&&y){y()
}},drop:function(A){if(y){y()
}o(A)
}},function(){})
})
}function u(){document.getElementById(s).style.top="-1000px"
}if(h){if(document.attachEvent&&(/MSIE/gi).test(navigator.userAgent)){v=document.createElement("div");
v.setAttribute("id",s);
d.extend(v.style,{position:"absolute",top:"-1000px",background:"red",filter:"alpha(opacity=0)",opacity:0});
document.body.appendChild(v);
d.addEvent(h,"dragenter",function(y){var z,x;
z=document.getElementById(g);
x=d.getPos(z);
d.extend(document.getElementById(s).style,{top:x.y+"px",left:x.x+"px",width:z.offsetWidth+"px",height:z.offsetHeight+"px"})
});
j(s,u)
}else{j(g)
}}d.addEvent(document.getElementById(q.browse_button),"click",function(F){var E=[],C,D,z=q.filters,A,B;
F.preventDefault();
if(f){return
}no_type_restriction:for(C=0;
C<z.length;
C++){A=z[C].extensions.split(",");
for(D=0;
D<A.length;
D++){if(A[D]==="*"){E=[];
break no_type_restriction
}B=d.mimeTypes[A[D]];
if(B&&d.inArray(B,E)===-1){E.push(d.mimeTypes[A[D]])
}}}p.FileBrowse.OpenBrowseDialog({mimeTypes:E},function(x){if(x.success){o(x.value)
}})
});
h=v=null
});
n.bind("CancelUpload",function(){p.Uploader.cancel({},function(){})
});
n.bind("DisableBrowse",function(h,g){f=g
});
n.bind("UploadFile",function(u,x){var v=m[x.id],y={},w=u.settings.chunk_size,j,h=[];
function z(B,s){var A;
if(x.status==d.FAILED){return
}y.name=x.target_name||x.name;
if(w){y.chunk=""+B;
y.chunks=""+s
}A=h.shift();
p.Uploader.upload({url:u.settings.url,files:{file:A},cookies:document.cookies,postvars:d.extend(y,u.settings.multipart_params),progressCallback:function(D){var E,C=0;
j[B]=parseInt(D.filePercent*A.size/100,10);
for(E=0;
E<j.length;
E++){C+=j[E]
}x.loaded=C;
u.trigger("UploadProgress",x)
}},function(E){var C,D;
if(E.success){C=E.value.statusCode;
if(w){u.trigger("ChunkUploaded",x,{chunk:B,chunks:s,response:E.value.body,status:C})
}if(h.length>0){z(++B,s)
}else{x.status=d.DONE;
u.trigger("FileUploaded",x,{response:E.value.body,status:C});
if(C>=400){u.trigger("Error",{code:d.HTTP_ERROR,message:d.translate("HTTP Error."),file:x,status:C})
}}}else{u.trigger("Error",{code:d.GENERIC_ERROR,message:d.translate("Generic Error."),file:x,details:E.error})
}})
}function g(s){x.size=s.size;
if(w){p.FileAccess.chunk({file:s,chunkSize:w},function(A){if(A.success){var D=A.value,C=D.length;
j=Array(C);
for(var B=0;
B<C;
B++){j[B]=0;
h.push(D[B])
}z(0,C)
}})
}else{j=Array(1);
h.push(s);
z(0,1)
}}if(r&&/\.(png|jpg|jpeg)$/i.test(x.name)){BrowserPlus.ImageAlter.transform({file:v,quality:r.quality||90,actions:[{scale:{maxwidth:r.width,maxheight:r.height}}]},function(s){if(s.success){g(s.value.file)
}})
}else{g(v)
}});
l({success:true})
}if(p){p.init(function(f){var g=[{service:"Uploader",version:"3"},{service:"DragAndDrop",version:"1"},{service:"FileBrowse",version:"1"},{service:"FileAccess",version:"2"}];
if(r){g.push({service:"ImageAlter",version:"4"})
}if(f.success){p.require({services:g},function(h){if(h.success){k()
}else{l()
}})
}else{l()
}})
}else{l()
}}})
})(plupload);
(function(r,p,q,v){var x={},s;
function n(f,d){var g;
if("FileReader" in r){g=new FileReader();
g.readAsDataURL(f);
g.onload=function(){d(g.result)
}
}else{return d(f.getAsDataURL())
}}function o(f,d){var g;
if("FileReader" in r){g=new FileReader();
g.readAsBinaryString(f);
g.onload=function(){d(g.result)
}
}else{return d(f.getAsBinary())
}}function w(d,g,j,k){var f,h,l,A,m=this;
n(x[d.id],function(B){f=p.createElement("canvas");
f.style.display="none";
p.body.appendChild(f);
h=f.getContext("2d");
l=new Image();
l.onerror=l.onabort=function(){k({success:false})
};
l.onload=function(){var G,E,F,I,H;
if(!g.width){g.width=l.width
}if(!g.height){g.height=l.height
}A=Math.min(g.width/l.width,g.height/l.height);
if(A<1){G=Math.round(l.width*A);
E=Math.round(l.height*A)
}else{if(g.quality&&j==="image/jpeg"){G=l.width;
E=l.height
}else{k({success:false});
return
}}f.width=G;
f.height=E;
h.drawImage(l,0,0,G,E);
if(j==="image/jpeg"){I=new u(atob(B.substring(B.indexOf("base64,")+7)));
if(I.headers&&I.headers.length){H=new z();
if(H.init(I.get("exif")[0])){H.setExif("PixelXDimension",G);
H.setExif("PixelYDimension",E);
I.set("exif",H.getBinary());
if(m.hasEventListener("ExifData")){m.trigger("ExifData",d,H.EXIF())
}if(m.hasEventListener("GpsData")){m.trigger("GpsData",d,H.GPS())
}}}}if(g.quality&&j==="image/jpeg"){try{B=f.toDataURL(j,g.quality/100)
}catch(D){B=f.toDataURL(j)
}}else{B=f.toDataURL(j)
}B=B.substring(B.indexOf("base64,")+7);
B=atob(B);
if(I&&I.headers&&I.headers.length){B=I.restore(B);
I.purge()
}f.parentNode.removeChild(f);
k({success:true,data:B})
};
l.src=B
})
}q.runtimes.Html5=q.addRuntime("html5",{getFeatures:function(){var d,j,f,g,h,k;
j=f=h=k=false;
if(r.XMLHttpRequest){d=new XMLHttpRequest();
f=!!d.upload;
j=!!(d.sendAsBinary||d.upload)
}if(j){g=!!(d.sendAsBinary||(r.Uint8Array&&r.ArrayBuffer));
h=!!(File&&(File.prototype.getAsDataURL||r.FileReader)&&g);
k=!!(File&&(File.prototype.mozSlice||File.prototype.webkitSlice||File.prototype.slice))
}s=q.ua.safari&&q.ua.windows;
return{html5:j,dragdrop:(function(){var l=p.createElement("div");
return("draggable" in l)||("ondragstart" in l&&"ondrop" in l)
}()),jpgresize:h,pngresize:h,multipart:h||!!r.FileReader||!!r.FormData,canSendBinary:g,cantSendBlobInFormData:!!(q.ua.gecko&&r.FormData&&r.FileReader&&!FileReader.prototype.readAsArrayBuffer),progress:f,chunks:k,multi_selection:!(q.ua.safari&&q.ua.windows),triggerDialog:(q.ua.gecko&&r.FormData||q.ua.webkit)}
},init:function(g,d){var j,f;
function h(l){var A,B,m=[],k,C={};
for(B=0;
B<l.length;
B++){A=l[B];
if(C[A.name]){continue
}C[A.name]=true;
k=q.guid();
x[k]=A;
m.push(new q.File(k,A.fileName||A.name,A.fileSize||A.size))
}if(m.length){g.trigger("FilesAdded",m)
}}j=this.getFeatures();
if(!j.html5){d({success:false});
return
}g.bind("Init",function(K){var M,O,l=[],L,k,P=K.settings.filters,N,m,R=p.body,Q;
M=p.createElement("div");
M.id=K.id+"_html5_container";
q.extend(M.style,{position:"absolute",background:g.settings.shim_bgcolor||"transparent",width:"100px",height:"100px",overflow:"hidden",zIndex:99999,opacity:g.settings.shim_bgcolor?"":0});
M.className="plupload html5";
if(g.settings.container){R=p.getElementById(g.settings.container);
if(q.getStyle(R,"position")==="static"){R.style.position="relative"
}}R.appendChild(M);
no_type_restriction:for(L=0;
L<P.length;
L++){N=P[L].extensions.split(/,/);
for(k=0;
k<N.length;
k++){if(N[k]==="*"){l=[];
break no_type_restriction
}m=q.mimeTypes[N[k]];
if(m&&q.inArray(m,l)===-1){l.push(m)
}}}M.innerHTML='<input id="'+g.id+'_html5"  style="font-size:999px" type="file" accept="'+l.join(",")+'" '+(g.settings.multi_selection&&g.features.multi_selection?'multiple="multiple"':"")+" />";
M.scrollTop=100;
Q=p.getElementById(g.id+"_html5");
if(K.features.triggerDialog){q.extend(Q.style,{position:"absolute",width:"100%",height:"100%"})
}else{q.extend(Q.style,{cssFloat:"right",styleFloat:"right"})
}Q.onchange=function(){h(this.files);
this.value=""
};
O=p.getElementById(K.settings.browse_button);
if(O){var I=K.settings.browse_button_hover,H=K.settings.browse_button_active,J=K.features.triggerDialog?O:M;
if(I){q.addEvent(J,"mouseover",function(){q.addClass(O,I)
},K.id);
q.addEvent(J,"mouseout",function(){q.removeClass(O,I)
},K.id)
}if(H){q.addEvent(J,"mousedown",function(){q.addClass(O,H)
},K.id);
q.addEvent(p.body,"mouseup",function(){q.removeClass(O,H)
},K.id)
}if(K.features.triggerDialog){q.addEvent(O,"click",function(A){var B=p.getElementById(K.id+"_html5");
if(B&&!B.disabled){B.click()
}A.preventDefault()
},K.id)
}}});
g.bind("PostInit",function(){var k=p.getElementById(g.settings.drop_element);
if(k){if(s){q.addEvent(k,"dragenter",function(l){var m,B,A;
m=p.getElementById(g.id+"_drop");
if(!m){m=p.createElement("input");
m.setAttribute("type","file");
m.setAttribute("id",g.id+"_drop");
m.setAttribute("multiple","multiple");
q.addEvent(m,"change",function(){h(this.files);
q.removeEvent(m,"change",g.id);
m.parentNode.removeChild(m)
},g.id);
k.appendChild(m)
}B=q.getPos(k,p.getElementById(g.settings.container));
A=q.getSize(k);
if(q.getStyle(k,"position")==="static"){q.extend(k.style,{position:"relative"})
}q.extend(m.style,{position:"absolute",display:"block",top:0,left:0,width:A.w+"px",height:A.h+"px",opacity:0})
},g.id);
return
}q.addEvent(k,"dragover",function(l){l.preventDefault()
},g.id);
q.addEvent(k,"drop",function(l){var m=l.dataTransfer;
if(m&&m.files){h(m.files)
}l.preventDefault()
},g.id)
}});
g.bind("Refresh",function(C){var B,A,m,k,l;
B=p.getElementById(g.settings.browse_button);
if(B){A=q.getPos(B,p.getElementById(C.settings.container));
m=q.getSize(B);
k=p.getElementById(g.id+"_html5_container");
q.extend(k.style,{top:A.y+"px",left:A.x+"px",width:m.w+"px",height:m.h+"px"});
if(g.features.triggerDialog){if(q.getStyle(B,"position")==="static"){q.extend(B.style,{position:"relative"})
}l=parseInt(q.getStyle(B,"zIndex"),10);
if(isNaN(l)){l=0
}q.extend(B.style,{zIndex:l});
q.extend(k.style,{zIndex:l-1})
}}});
g.bind("DisableBrowse",function(m,k){var l=p.getElementById(m.id+"_html5");
if(l){l.disabled=k
}});
g.bind("CancelUpload",function(){if(f&&f.abort){f.abort()
}});
g.bind("UploadFile",function(C,A){var m=C.settings,D,B;
function k(E,F,H){var I;
if(File.prototype.slice){try{E.slice();
return E.slice(F,H)
}catch(G){return E.slice(F,H-F)
}}else{if(I=File.prototype.webkitSlice||File.prototype.mozSlice){return I.call(E,F,H)
}else{return null
}}}function l(E){var F=0,H=0,G=("FileReader" in r)?new FileReader:null;
function I(){var R,N,P,O,S,Q,U,V=C.settings.url;
function T(J){var L=0,aa="----pluploadboundary"+q.guid(),Z,Y="--",K="\r\n",W="";
f=new XMLHttpRequest;
if(f.upload){f.upload.onprogress=function(ab){A.loaded=Math.min(A.size,H+ab.loaded-L);
C.trigger("UploadProgress",A)
}
}f.onreadystatechange=function(){var ab,ac;
if(f.readyState==4&&C.state!==q.STOPPED){try{ab=f.status
}catch(ad){ab=0
}if(ab>=400){C.trigger("Error",{code:q.HTTP_ERROR,message:q.translate("HTTP Error."),file:A,status:ab})
}else{if(P){ac={chunk:F,chunks:P,response:f.responseText,status:ab};
C.trigger("ChunkUploaded",A,ac);
H+=Q;
if(ac.cancelled){A.status=q.FAILED;
return
}A.loaded=Math.min(A.size,(F+1)*S)
}else{A.loaded=A.size
}C.trigger("UploadProgress",A);
J=R=Z=W=null;
if(!P||++F>=P){A.status=q.DONE;
C.trigger("FileUploaded",A,{response:f.responseText,status:ab})
}else{I()
}}}};
if(C.settings.multipart&&j.multipart){O.name=A.target_name||A.name;
f.open("post",V,true);
q.each(C.settings.headers,function(ac,ab){f.setRequestHeader(ab,ac)
});
if(typeof(J)!=="string"&&!!r.FormData){Z=new FormData();
q.each(q.extend(O,C.settings.multipart_params),function(ac,ab){Z.append(ab,ac)
});
Z.append(C.settings.file_data_name,J);
f.send(Z);
return
}if(typeof(J)==="string"){f.setRequestHeader("Content-Type","multipart/form-data; boundary="+aa);
q.each(q.extend(O,C.settings.multipart_params),function(ac,ab){W+=Y+aa+K+'Content-Disposition: form-data; name="'+ab+'"'+K+K;
W+=unescape(encodeURIComponent(ac))+K
});
U=q.mimeTypes[A.name.replace(/^.+\.([^.]+)/,"$1").toLowerCase()]||"application/octet-stream";
W+=Y+aa+K+'Content-Disposition: form-data; name="'+C.settings.file_data_name+'"; filename="'+unescape(encodeURIComponent(A.name))+'"'+K+"Content-Type: "+U+K+K+J+K+Y+aa+Y+K;
L=W.length-J.length;
J=W;
if(f.sendAsBinary){f.sendAsBinary(J)
}else{if(j.canSendBinary){var M=new Uint8Array(J.length);
for(var X=0;
X<J.length;
X++){M[X]=(J.charCodeAt(X)&255)
}f.send(M.buffer)
}}return
}}V=q.buildUrl(C.settings.url,q.extend(O,C.settings.multipart_params));
f.open("post",V,true);
f.setRequestHeader("Content-Type","application/octet-stream");
q.each(C.settings.headers,function(ac,ab){f.setRequestHeader(ab,ac)
});
f.send(J)
}if(A.status==q.DONE||A.status==q.FAILED||C.state==q.STOPPED){return
}O={name:A.target_name||A.name};
if(m.chunk_size&&A.size>m.chunk_size&&(j.chunks||typeof(E)=="string")){S=m.chunk_size;
P=Math.ceil(A.size/S);
Q=Math.min(S,A.size-(F*S));
if(typeof(E)=="string"){R=E.substring(F*S,F*S+Q)
}else{R=k(E,F*S,F*S+Q)
}O.chunk=F;
O.chunks=P
}else{Q=A.size;
R=E
}if(C.settings.multipart&&j.multipart&&typeof(R)!=="string"&&G&&j.cantSendBlobInFormData&&j.chunks&&C.settings.chunk_size){G.onload=function(){T(G.result)
};
G.readAsBinaryString(R)
}else{T(R)
}}I()
}D=x[A.id];
if(j.jpgresize&&C.settings.resize&&/\.(png|jpg|jpeg)$/i.test(A.name)){w.call(C,A,C.settings.resize,/\.png$/i.test(A.name)?"image/png":"image/jpeg",function(E){if(E.success){A.size=E.data.length;
l(E.data)
}else{if(j.chunks){l(D)
}else{o(D,l)
}}})
}else{if(!j.chunks&&j.jpgresize){o(D,l)
}else{l(D)
}}});
g.bind("Destroy",function(B){var m,l,A=p.body,k={inputContainer:B.id+"_html5_container",inputFile:B.id+"_html5",browseButton:B.settings.browse_button,dropElm:B.settings.drop_element};
for(m in k){l=p.getElementById(k[m]);
if(l){q.removeAllEvents(l,B.id)
}}q.removeAllEvents(p.body,B.id);
if(B.settings.container){A=p.getElementById(B.settings.container)
}A.removeChild(p.getElementById(k.inputContainer))
});
d({success:true})
}});
function y(){var f=false,h;
function d(A,l){var B=f?0:-8*(l-1),k=0,m;
for(m=0;
m<l;
m++){k|=(h.charCodeAt(A+m)<<Math.abs(B+m*8))
}return k
}function j(k,m,l){var l=arguments.length===3?l:h.length-m-1;
h=h.substr(0,m)+k+h.substr(l+m)
}function g(B,A,l){var k="",C=f?0:-8*(l-1),m;
for(m=0;
m<l;
m++){k+=String.fromCharCode((A>>Math.abs(C+m*8))&255)
}j(k,B,l)
}return{II:function(k){if(k===v){return f
}else{f=k
}},init:function(k){f=false;
h=k
},SEGMENT:function(m,k,l){switch(arguments.length){case 1:return h.substr(m,h.length-m-1);
case 2:return h.substr(m,k);
case 3:j(l,m,k);
break;
default:return h
}},BYTE:function(k){return d(k,1)
},SHORT:function(k){return d(k,2)
},LONG:function(l,k){if(k===v){return d(l,4)
}else{g(l,k,4)
}},SLONG:function(l){var k=d(l,4);
return(k>2147483647?k-4294967296:k)
},STRING:function(m,l){var k="";
for(l+=m;
m<l;
m++){k+=String.fromCharCode(d(m,1))
}return k
}}
}function u(g){var d={65505:{app:"EXIF",name:"APP1",signature:"Exif\0"},65506:{app:"ICC",name:"APP2",signature:"ICC_PROFILE\0"},65517:{app:"IPTC",name:"APP13",signature:"Photoshop 3.0\0"}},f=[],h,m,k=v,j=0,l;
h=new y();
h.init(g);
if(h.SHORT(0)!==65496){return
}m=2;
l=Math.min(1048576,g.length);
while(m<=l){k=h.SHORT(m);
if(k>=65488&&k<=65495){m+=2;
continue
}if(k===65498||k===65497){break
}j=h.SHORT(m+2)+2;
if(d[k]&&h.STRING(m+4,d[k].signature.length)===d[k].signature){f.push({hex:k,app:d[k].app.toUpperCase(),name:d[k].name.toUpperCase(),start:m,length:j,segment:h.SEGMENT(m,j)})
}m+=j
}h.init(null);
return{headers:f,restore:function(E){h.init(E);
var B=new u(E);
if(!B.headers){return false
}for(var A=B.headers.length;
A>0;
A--){var D=B.headers[A-1];
h.SEGMENT(D.start,D.length,"")
}B.purge();
m=h.SHORT(2)==65504?4+h.SHORT(4):2;
for(var A=0,C=f.length;
A<C;
A++){h.SEGMENT(m,0,f[A].segment);
m+=f[A].length
}return h.SEGMENT()
},get:function(A){var D=[];
for(var B=0,C=f.length;
B<C;
B++){if(f[B].app===A.toUpperCase()){D.push(f[B].segment)
}}return D
},set:function(E,A){var D=[];
if(typeof(A)==="string"){D.push(A)
}else{D=A
}for(var B=ii=0,C=f.length;
B<C;
B++){if(f[B].app===E.toUpperCase()){f[B].segment=D[ii];
f[B].length=D[ii].length;
ii++
}if(ii>=D.length){break
}}},purge:function(){f=[];
h.init(null)
}}
}function z(){var h,l,k={},d;
h=new y();
l={tiff:{274:"Orientation",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer"},exif:{36864:"ExifVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",36867:"DateTimeOriginal",33434:"ExposureTime",33437:"FNumber",34855:"ISOSpeedRatings",37377:"ShutterSpeedValue",37378:"ApertureValue",37383:"MeteringMode",37384:"LightSource",37385:"Flash",41986:"ExposureMode",41987:"WhiteBalance",41990:"SceneCaptureType",41988:"DigitalZoomRatio",41992:"Contrast",41993:"Saturation",41994:"Sharpness"},gps:{0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude"}};
d={ColorSpace:{1:"sRGB",0:"Uncalibrated"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{1:"Daylight",2:"Fliorescent",3:"Tungsten",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 -5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire.",1:"Flash fired.",5:"Strobe return light not detected.",7:"Strobe return light detected.",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},ExposureMode:{0:"Auto exposure",1:"Manual exposure",2:"Auto bracket"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},GPSLatitudeRef:{N:"North latitude",S:"South latitude"},GPSLongitudeRef:{E:"East longitude",W:"West longitude"}};
function j(Q,H){var N=h.SHORT(Q),K,R,P,I,J,O,M,m,S=[],L={};
for(K=0;
K<N;
K++){M=O=Q+12*K+2;
P=H[h.SHORT(M)];
if(P===v){continue
}I=h.SHORT(M+=2);
J=h.LONG(M+=2);
M+=4;
S=[];
switch(I){case 1:case 7:if(J>4){M=h.LONG(M)+k.tiffHeader
}for(R=0;
R<J;
R++){S[R]=h.BYTE(M+R)
}break;
case 2:if(J>4){M=h.LONG(M)+k.tiffHeader
}L[P]=h.STRING(M,J-1);
continue;
case 3:if(J>2){M=h.LONG(M)+k.tiffHeader
}for(R=0;
R<J;
R++){S[R]=h.SHORT(M+R*2)
}break;
case 4:if(J>1){M=h.LONG(M)+k.tiffHeader
}for(R=0;
R<J;
R++){S[R]=h.LONG(M+R*4)
}break;
case 5:M=h.LONG(M)+k.tiffHeader;
for(R=0;
R<J;
R++){S[R]=h.LONG(M+R*4)/h.LONG(M+R*4+4)
}break;
case 9:M=h.LONG(M)+k.tiffHeader;
for(R=0;
R<J;
R++){S[R]=h.SLONG(M+R*4)
}break;
case 10:M=h.LONG(M)+k.tiffHeader;
for(R=0;
R<J;
R++){S[R]=h.SLONG(M+R*4)/h.SLONG(M+R*4+4)
}break;
default:continue
}m=(J==1?S[0]:S);
if(d.hasOwnProperty(P)&&typeof m!="object"){L[P]=d[P][m]
}else{L[P]=m
}}return L
}function f(){var m=v,A=k.tiffHeader;
h.II(h.SHORT(A)==18761);
if(h.SHORT(A+=2)!==42){return false
}k.IFD0=k.tiffHeader+h.LONG(A+=2);
m=j(k.IFD0,l.tiff);
k.exifIFD=("ExifIFDPointer" in m?k.tiffHeader+m.ExifIFDPointer:v);
k.gpsIFD=("GPSInfoIFDPointer" in m?k.tiffHeader+m.GPSInfoIFDPointer:v);
return true
}function g(D,F,G){var I,H,C,m=0;
if(typeof(F)==="string"){var E=l[D.toLowerCase()];
for(hex in E){if(E[hex]===F){F=hex;
break
}}}I=k[D.toLowerCase()+"IFD"];
H=h.SHORT(I);
for(i=0;
i<H;
i++){C=I+12*i+2;
if(h.SHORT(C)==F){m=C+8;
break
}}if(!m){return false
}h.LONG(m,G);
return true
}return{init:function(m){k={tiffHeader:10};
if(m===v||!m.length){return false
}h.init(m);
if(h.SHORT(0)===65505&&h.STRING(4,5).toUpperCase()==="EXIF\0"){return f()
}return false
},EXIF:function(){var A;
A=j(k.exifIFD,l.exif);
if(A.ExifVersion&&q.typeOf(A.ExifVersion)==="array"){for(var m=0,B="";
m<A.ExifVersion.length;
m++){B+=String.fromCharCode(A.ExifVersion[m])
}A.ExifVersion=B
}return A
},GPS:function(){var m;
m=j(k.gpsIFD,l.gps);
if(m.GPSVersionID){m.GPSVersionID=m.GPSVersionID.join(".")
}return m
},setExif:function(A,m){if(A!=="PixelXDimension"&&A!=="PixelYDimension"){return false
}return g("exif",A,m)
},getBinary:function(){return h.SEGMENT()
}}
}})(window,document,plupload);
(function(j,g,f,k){function h(d){return g.getElementById(d)
}f.runtimes.Html4=f.addRuntime("html4",{getFeatures:function(){return{multipart:true,triggerDialog:(f.ua.gecko&&j.FormData||f.ua.webkit)}
},init:function(l,d){l.bind("Init",function(B){var H=g.body,D,I="javascript",G,K,A,J=[],y=/MSIE/.test(navigator.userAgent),O=[],E=B.settings.filters,C,F,P,L;
no_type_restriction:for(C=0;
C<E.length;
C++){F=E[C].extensions.split(/,/);
for(L=0;
L<F.length;
L++){if(F[L]==="*"){O=[];
break no_type_restriction
}P=f.mimeTypes[F[L]];
if(P&&f.inArray(P,O)===-1){O.push(P)
}}}O=O.join(",");
function M(){var n,m,p,o;
A=f.guid();
J.push(A);
n=g.createElement("form");
n.setAttribute("id","form_"+A);
n.setAttribute("method","post");
n.setAttribute("enctype","multipart/form-data");
n.setAttribute("encoding","multipart/form-data");
n.setAttribute("target",B.id+"_iframe");
n.style.position="absolute";
m=g.createElement("input");
m.setAttribute("id","input_"+A);
m.setAttribute("type","file");
m.setAttribute("accept",O);
m.setAttribute("size",1);
o=h(B.settings.browse_button);
if(B.features.triggerDialog&&o){f.addEvent(h(B.settings.browse_button),"click",function(q){if(!m.disabled){m.click()
}q.preventDefault()
},B.id)
}f.extend(m.style,{width:"100%",height:"100%",opacity:0,fontSize:"99px",cursor:"pointer"});
f.extend(n.style,{overflow:"hidden"});
p=B.settings.shim_bgcolor;
if(p){n.style.background=p
}if(y){f.extend(m.style,{filter:"alpha(opacity=0)"})
}f.addEvent(m,"change",function(r){var u=r.target,v,s=[],q;
if(u.value){h("form_"+A).style.top=-1048575+"px";
v=u.value.replace(/\\/g,"/");
v=v.substring(v.length,v.lastIndexOf("/")+1);
s.push(new f.File(A,v));
if(!B.features.triggerDialog){f.removeAllEvents(n,B.id)
}else{f.removeEvent(o,"click",B.id)
}f.removeEvent(m,"change",B.id);
M();
if(s.length){l.trigger("FilesAdded",s)
}}},B.id);
n.appendChild(m);
H.appendChild(n);
B.refresh()
}function N(){var m=g.createElement("div");
m.innerHTML='<iframe id="'+B.id+'_iframe" name="'+B.id+'_iframe" src="'+I+':&quot;&quot;" style="display:none"></iframe>';
D=m.firstChild;
H.appendChild(D);
f.addEvent(D,"load",function(p){var o=p.target,q,n;
if(!G){return
}try{q=o.contentWindow.document||o.contentDocument||j.frames[o.id].document
}catch(r){B.trigger("Error",{code:f.SECURITY_ERROR,message:f.translate("Security error."),file:G});
return
}n=q.body.innerHTML;
if(n){G.status=f.DONE;
G.loaded=1025;
G.percent=100;
B.trigger("UploadProgress",G);
B.trigger("FileUploaded",G,{response:n})
}},B.id)
}if(B.settings.container){H=h(B.settings.container);
if(f.getStyle(H,"position")==="static"){H.style.position="relative"
}}B.bind("UploadFile",function(p,o){var n,m;
if(o.status==f.DONE||o.status==f.FAILED||p.state==f.STOPPED){return
}n=h("form_"+o.id);
m=h("input_"+o.id);
m.setAttribute("name",p.settings.file_data_name);
n.setAttribute("action",p.settings.url);
f.each(f.extend({name:o.target_name||o.name},p.settings.multipart_params),function(q,s){var r=g.createElement("input");
f.extend(r,{type:"hidden",name:s,value:q});
n.insertBefore(r,n.firstChild)
});
G=o;
h("form_"+A).style.top=-1048575+"px";
n.submit()
});
B.bind("FileUploaded",function(m){m.refresh()
});
B.bind("StateChanged",function(m){if(m.state==f.STARTED){N()
}else{if(m.state==f.STOPPED){j.setTimeout(function(){f.removeEvent(D,"load",m.id);
if(D.parentNode){D.parentNode.removeChild(D)
}},0)
}}f.each(m.files,function(p,n){if(p.status===f.DONE||p.status===f.FAILED){var o=h("form_"+p.id);
if(o){o.parentNode.removeChild(o)
}}})
});
B.bind("Refresh",function(p){var u,o,n,m,q,s,r,v,w;
u=h(p.settings.browse_button);
if(u){q=f.getPos(u,h(p.settings.container));
s=f.getSize(u);
r=h("form_"+A);
v=h("input_"+A);
f.extend(r.style,{top:q.y+"px",left:q.x+"px",width:s.w+"px",height:s.h+"px"});
if(p.features.triggerDialog){if(f.getStyle(u,"position")==="static"){f.extend(u.style,{position:"relative"})
}w=parseInt(u.style.zIndex,10);
if(isNaN(w)){w=0
}f.extend(u.style,{zIndex:w});
f.extend(r.style,{zIndex:w-1})
}n=p.settings.browse_button_hover;
m=p.settings.browse_button_active;
o=p.features.triggerDialog?u:r;
if(n){f.addEvent(o,"mouseover",function(){f.addClass(u,n)
},p.id);
f.addEvent(o,"mouseout",function(){f.removeClass(u,n)
},p.id)
}if(m){f.addEvent(o,"mousedown",function(){f.addClass(u,m)
},p.id);
f.addEvent(g.body,"mouseup",function(){f.removeClass(u,m)
},p.id)
}}});
l.bind("FilesRemoved",function(p,o){var m,n;
for(m=0;
m<o.length;
m++){n=h("form_"+o[m].id);
if(n){n.parentNode.removeChild(n)
}}});
l.bind("DisableBrowse",function(o,n){var m=g.getElementById("input_"+A);
if(m){m.disabled=n
}});
l.bind("Destroy",function(q){var m,p,o,n={inputContainer:"form_"+A,inputFile:"input_"+A,browseButton:q.settings.browse_button};
for(m in n){p=h(n[m]);
if(p){f.removeAllEvents(p,q.id)
}}f.removeAllEvents(g.body,q.id);
f.each(J,function(r,s){o=h("form_"+r);
if(o){H.removeChild(o)
}})
});
M()
});
d({success:true})
}})
})(window,document,plupload)
},{}],94:[function(b,c,a){!function(h,g){var j=h(document);
var f;
g.modifierKey=false;
g.keys=f={UP:38,DOWN:40,LEFT:37,RIGHT:39,RETURN:13,ESCAPE:27,BACKSPACE:8,SPACE:32};
var d={map:{},bound:false,press:function(l){var k=l.keyCode||l.which;
if(k in d.map&&typeof d.map[k]==="function"){d.map[k].call(self,l)
}},attach:function(m){var l,k;
for(l in m){if(m.hasOwnProperty(l)){k=l.toUpperCase();
if(k in d.keys){d.map[d.keys[k]]=m[l]
}else{d.map[k]=m[l]
}}}if(!d.bound){d.bound=true;
j.bind("keydown",d.press)
}},detach:function(){d.bound=false;
d.map={};
j.unbind("keydown",d.press)
}};
j.keydown(function(l){var k=l.keyCode||l.which;
if(k===16||k===91||k===18||k===17){modifierKey=true
}else{modifierKey=false
}if(k===f.ESCAPE){j.trigger("esc")
}if(k===f.LEFT){j.trigger("lightbox:left")
}if(k===f.RIGHT){j.trigger("lightbox:right")
}});
j.keyup(function(k){modifierKey=false
})
}(jQuery,window)
},{}],95:[function(f,g,b){var a,d=function(j,k){return function(){return j.apply(k,arguments)
}
},c={}.hasOwnProperty,h=function(m,k){for(var j in k){if(c.call(k,j)){m[j]=k[j]
}}function l(){this.constructor=m
}l.prototype=k.prototype;
m.prototype=new l();
m.__super__=k.prototype;
return m
};
this.AIR||(this.AIR={});
a=this.AIR;
a.Views||(a.Views={});
a.Views.BaseView=(function(k){h(j,k);
function j(){this.render=d(this.render,this);
this.initialize=d(this.initialize,this);
return j.__super__.constructor.apply(this,arguments)
}j.prototype.template=null;
j.prototype._hasRendered=false;
j.prototype.initialize=function(l){this._bindViewEvents();
this.bindings();
return this._postInitialize()
};
j.prototype._bindViewEvents=function(){if(this.viewEvents==null){return
}return _.each(this.viewEvents,(function(l){return function(n,m){if(_.isString(n)){n=l[n]
}return l.on(m,n,l)
}
})(this))
};
j.prototype._postInitialize=function(){this.postInitialize();
return this.trigger("initialize")
};
j.prototype.postInitialize=function(){};
j.prototype._preRender=function(){this.preRender();
return this.trigger("render:pre")
};
j.prototype.preRender=function(){};
j.prototype.getRenderData=function(){if(this.model){return this.model.toJSON()
}else{return{}
}};
j.prototype.getTemplate=function(){if(this.template&&JST[this.template]){return JST[this.template]
}else{return null
}};
j.prototype.getHtml=function(){var l;
l=this.getTemplate();
if(l){return l(this.getRenderData(),{partials:JST})
}else{return""
}};
j.prototype.render=function(l){if(l==null){l={}
}this._preRender();
if(l.html!==false){this.$el.html(this.getHtml())
}this.trigger("render");
this._bindUIElements();
this._postRender();
this._hasRendered=true;
return this
};
j.prototype._postRender=function(){this.postRender();
return this.trigger("render:post")
};
j.prototype._bindUIElements=function(){var n,l,o,m;
if(!this.ui){return
}if(!this.uiBindings){this.uiBindings=_.result(this,"ui")
}this.ui={};
o=this.uiBindings;
m=[];
for(n in o){l=o[n];
m.push(this.ui[n]=this.$(l))
}return m
};
j.prototype.postRender=function(){};
j.prototype.bindings=function(){};
j.prototype.cleanup=function(){this.trigger("cleanup");
this.dispose();
return this.remove()
};
j.prototype.dispose=function(){return;
this.undelegateEvents();
if(this.model){this.model.off(null,null,this)
}if(this.collection){this.collection.off(null,null,this)
}return this
};
j.prototype.$get=function(m,l){if(l==null){l=false
}this._$getEls||(this._$getEls={});
if(l||!this._$getEls[m]){this._$getEls[m]=this.$("[data-"+m+"]")
}return this._$getEls[m]
};
return j
})(Backbone.View);
if(typeof g!=="undefined"&&g!==null){g.exports=a.Views.BaseView
}},{}]},{},[90]);